Hi All,
I am trying to generate xxx.hbm.xml mapping file thru XDOCLET for composite-id type. I have got three table in my DB schema (Roles, User_Head & User_Det).
Roles
-------
RoleId Varchar2(3) Primary Key
RoleDesc Varchar2(20) Not Null
User_Head
----------
UserId Varchar2(6) Primary Key
UserName Varchar2(20) Not Null
User_Det
---------
UserId Varchar2(6) Not Null References User_Head(UserId)
RoleId Varchar2(3) Not Null References Roles(RoleId)
Constraint userdet_pk Primary Key (UserId,RoleId)
For the Roles tables I have values already inserted in that
RoleId RoleDesc
---------------------
ROA Role A
ROB Role B
Now I want to create a composite-id for User_Det table I am unable to do it. What I have done is I have created a two Java Bean Class for User_Head table & User_Det table. But I am unable to create composite-id key thru XDOCLET.
Can anybody know how to workout for this.
Thanks in advance
-Ajay
-
Generating hibernate xml file thru XDoclet for composite-id (2 messages)
- Posted by: Ajay G
- Posted on: December 20 2004 07:19 EST
Threaded Messages (2)
- Hibernate Composite-id Not Supported by Jeff Johnson on January 05 2005 17:39 EST
- Use static inner class by Jeff Johnson on January 05 2005 18:39 EST
-
Hibernate Composite-id Not Supported[ Go to top ]
- Posted by: Jeff Johnson
- Posted on: January 05 2005 17:39 EST
- in response to Ajay G
XDoclet does not currently support composite id's.
http://www.hibernate.org/52.html#A14
XDoclet 2 was started to expand upon issues like this. However, after an announcement a while back ( http://www.theserverside.com/news/thread.tss?thread_id=21157 ), the project is still in development.
http://xdoclet.codehaus.org/HibernateTags
http://sourceforge.net/projects/xdoclet-plugins/
You could always add a custom parser to your ANT build to do this for you. Here's an example, http://www.jroller.com/comments/rkischuk/Weblog/hibernate_composite_id_generation_with
-jeff -
Use static inner class[ Go to top ]
- Posted by: Jeff Johnson
- Posted on: January 05 2005 18:39 EST
- in response to Ajay G
But a better work around for this is to use a static inner class for your primary key. This will also prevent you from having to create an additional key class.