-->
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.  [ 4 posts ] 
Author Message
 Post subject: ejb annotation on table with no primary keys
PostPosted: Tue Sep 06, 2005 8:58 pm 
Newbie

Joined: Wed May 12, 2004 5:09 pm
Posts: 17
Location: Los Angeles
Hello,

I have a simple table (Dm_bogus) with two fields, no primary key.

I reverse engineer it with:

<hbm2java ejb3="true"/>

and get 2 files: DmBogus.java and DmBogusId.java. So far so good.
But DmBogus.java is generated with the following annotation in front of id:

@Id(generate = GeneratorType.AUTO)
@Column(name = "CUST_ID")
@Column(name = "TIMESTAMP")
public DmBogusId getId() {
return this.id;
}

Which, of course, doesn't compile:

[javac] C:\umg\java\tools\DmBogus.java:45: duplicate annotation
[javac] @Column(name = "TIMESTAMP")
[javac] ^
[javac] 1 error

I have to remove both @Column's for it to compile.
Is this a bug? Is there a workaround?
Thanks!!!

Egor


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 4:57 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you have to have a (composite) primary key, ie a way to retrieve a particular row.
In you case the reg eng is not working fine, Check the annotations doc to see how to map a composite PK

_________________
Emmanuel


Top
 Profile  
 
 Post subject: but how do I fix rev eng?
PostPosted: Wed Sep 07, 2005 2:12 pm 
Newbie

Joined: Wed May 12, 2004 5:09 pm
Posts: 17
Location: Los Angeles
Emmanuel,

Thank you for the reply. You say my reverse engineering is not working; I can see that. And my question was, why not? It works fine on the same table when I generate hbm.xml + java. It just doesn't work when I put ejb3="true" in hbm2java.

I've read the part about composite keys you suggested (http://www.hibernate.org/hib_docs/annot ... e/#d0e1128) but it doesn't talk about reverse engineering.

My question was how do I fix reverse engineering so it generates the java file correctly; I KNOW how to fix it manually, but how do I make it work correctly in the first place? If this is not the right forum to discuss reverse engineering and hbm2java, please point me where to ask that question.

Thank you--

Egor


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 09, 2005 6:16 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The diff is a matter of time and resource.
Post a mail to the developer mailing list. Max will be happy to have a contributor on that area.

_________________
Emmanuel


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