-->
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.  [ 7 posts ] 
Author Message
 Post subject: XDoclet & Views & @hibernate.id problems
PostPosted: Fri Nov 18, 2005 1:24 am 
Newbie

Joined: Fri Nov 18, 2005 1:15 am
Posts: 3
Hi Guys

I created a view with three columns and also implemented a model class for that. The view doens't have an id(pk) column and therefore I didn't define any @hibernate.id in my model class.
But as soon as I compile it with the xdoclet it come back with the following error: ... misses ID property....

Is there a way to develop a model class without the hibernate.id property in xdoclets ?

DB:Oracle
Hibernate 3.0


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 4:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Hibernate requires the ID. Its not a relational entity if you do not have something acting as the key. Some people make all fields the properties of one large composite key, others choose the fields that can be a unique indentifier, other options (limited though) is the rowid. First decide how you want to do it with hibernate then look at getting XDoclet to generate the mapping approach that you have chosen.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 6:10 pm 
Newbie

Joined: Fri Nov 18, 2005 1:15 am
Posts: 3
Quote:
Some people make all fields the properties of one large composite key


That would suit me. How do I do this ? Is there a @hibernate.composite-id tag ?

Cheers
Rolf


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 3:16 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
See http://xdoclet.sourceforge.net/xdoclet/tags/hibernate-tags.html

for a list of tags (for the latest XDoclet release).

As far as using it, you need to setup the main class with an ID reference and then all the properties of the class that is the key will be tagged appropriatey.

XDoclet does not support integrated composite keys.
Search this forum for other posts on composite keys and XDoclet for more info (or Google).


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 6:09 pm 
Newbie

Joined: Fri Nov 18, 2005 1:15 am
Posts: 3
Is there any sample code for composite keys available ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 9:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Some more support for integrated comnposite Keys is in CVS now. You could also use a inner class as the key rather than a full class. In anycase, there are sample with the XDoclet distribution/CVS.

See JIRA for latest enhancements
http://opensource2.atlassian.com/projects/xdoclet/browse/XDT-414


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 9:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I decided to have a quick look around and found this good tutorial (Hibernate 2 and XDoclet) that also includes composite keys.

http://www.downside.ch/hibernate/hibernatetutorial-1.4.pdf

Hope this helps.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.