Results 1 to 2 of 2

Thread: Using Hibernate Criteria API with unmapped classes

  1. #1
    Join Date
    Mar 2007
    Posts
    27

    Default Using Hibernate Criteria API with unmapped classes

    Hi all,

    I have a class mapped to a DB table that references another, unmapped table to get information about the tips - this unmapped table associates rows in my mapped table with dates on a one-to-one basis (think of an "X of the day" relation).

    I'm using the Hibernate criteria API in my DAO to access this mapped table, but I'd also like to use it to access this date-specific information without going to the relative trouble of mapping the currently unmapped table.

    The "Java persistence with Hibernate" book has limited coverage of Criteria (just the basic usages), so I'm not sure if I'm barking up the wrong tree with what I'm trying to accomplish, but it seems like there's some syntax that is (or should be!) available within the Restrictions class that would allow me to use an external table to restrict my query results. Does anyone have any experience with this kind of behavior?

    Thanks
    - Bryan M.

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    Quote Originally Posted by rafuzo View Post
    I'm using the Hibernate criteria API in my DAO to access this mapped table, but I'd also like to use it to access this date-specific information without going to the relative trouble of mapping the currently unmapped table.
    Out of interest, why not just map the class? It's not that much effort.
    Last edited by karldmoore; Aug 30th, 2007 at 05:24 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •