Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-31-2007, 04:24 AM
Member
 
Join Date: May 2007
Posts: 39
Nick15 is on a distinguished road
xdoclet and hibernate
Hello
I'm searching some examples about how can I generate a composite id with the tags of the XDoclet.
Can you help me?

Last edited by Nick15 : 06-01-2007 at 02:17 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-31-2007, 03:44 PM
Member
 
Join Date: May 2007
Posts: 38
Marty is on a distinguished road
Hi nick
Code:
/** * @hibernate.class table="table" */ public class ClasswithCompositeId { private ClasswithCompositeIdPk PK; /** * @hibernate.id generator-class="assigned" * */ public ClasswithCompositeIdPk getPK() { return this.PK; } public void setPK(ClasswithCompositeIdPk thePK) { this.PK = thePK; return; } } package saes.election.eligibleoption; import java.io.Serializable; import org.apache.commons.lang.builder.*; public class ClasswithCompositeIdPk implements Serializable { /** * The composed eligible option this role is related to */ private Class1 key1; /** * The candidate this role is related to */ private Class2 key2; /** * @inheritDoc */ @Override public boolean equals(Object o) { } /** * @inheritDoc */ @Override public int hashCode() { } /** * @hibernate.many-to-one column="key1_code" outer-join="true" */ public Class1 getKey1() { return this.key1; } public void setCandidate(Class1 key1) { this.key1 = key1 ; } /** * @hibernate.many-to-one column="key2_code" outer-join="true" */ public Clase2 getClave2() { return this.key2; } public void setCandidate(Class2 key2 ) { this.key2 = key2 ; } } <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping > <class name="ClasswithCompositeIdPk " table="table" lazy="false" > <composite-id name="keyPK" class="ClasswithCompositeIdPk " > <key-many-to-one name="key1" class="Class1" column="class1_code" /> <key-many-to-one name="key2" class="Class2" column="class2_code" /> </composite-id> <!-- To add non XDoclet property mappings, create a file named hibernate-properties-RoleData.xml containing the additional properties and place it in your merge dir. --> </class> </hibernate-mapping>
good luck
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hibernate, help me Nick15 Database 2 06-05-2008 04:39 PM
EJB generation with xdoclet tags gugas Enterprise JavaBeans 0 02-18-2008 02:07 PM
org.hibernate.ejb.Version <clinit> INFO: Hibernate EntityManager 3.2.0.CR1 Heather Database 2 06-30-2007 04:01 PM
Hibernate Alan Database 2 05-11-2007 02:19 AM
Configuring Xdoclet for J2ee Applications in Eclipse JavaForums Eclipse 0 04-26-2007 11:15 AM


All times are GMT +3. The time now is 10:07 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org