-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Custom SQL mapped to Class without ID
PostPosted: Tue Apr 17, 2012 4:51 pm 
Newbie

Joined: Fri Aug 26, 2011 5:40 pm
Posts: 6
I have some custom SQL that returns a list of names and stats. I'm trying to map this to a POJO class but my hbm.xml won't let me create a class that has no ID. Should I be using something other than a class?


Top
 Profile  
 
 Post subject: Re: Custom SQL mapped to Class without ID
PostPosted: Thu Apr 19, 2012 11:47 am 
Newbie

Joined: Fri Aug 26, 2011 5:40 pm
Posts: 6
So I fabricated a primary key to get hibernate to stop complaining. Probably not the best practice but it works and no one seems to have a suggestion.

I know I could use HQL or criteria queries but I have the SQL that gets me what I want. I just wanted hibernate to map the results into POJOs. Not sure why hibernate only thinks in terms of exact database representation. Most of the objects that make sense for my apps differ from proper DB structure.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.