[jboss-user] [JBoss Seam] - seam-gen problem when same table is referenced two times
marius.oancea
do-not-reply at jboss.com
Wed Sep 26 10:43:10 EDT 2007
Hello,
I have a table USER and a table ADDRESS.
USER has two (important) attributes :
- localAddress
- remoteAddress
both are foreign keys to ADDRESS table.
So in ADDRESS table we will have two records for each user.
seam generate-entities perfectly generate the beans but home entities are wrong. Name of address home entities injected in user home have the same name.
| create table xx.user (
| userid varchar(10)NOT NULL PRIMARY KEY,
| local_address integer,
| remote_address integer
| ) in userspace1;
|
| create table xx.ADDRESS (
| adrid integer NOT NULL PRIMARY KEY,
| street varchar(200),
| streetNo integer
| ) in userspace1;
|
| alter table xx.user add CONSTRAINT ADR1 foreign key (local_address) references xx.ADDRESS(adrid);
| alter table xx.user add CONSTRAINT ADR2 foreign key (remote_address) references xx.ADDRESS(adrid);
|
| Entity user is good:
| @Entity
| @Table(name = "USER", schema = "xx")
| public class User implements java.io.Serializable {
|
| private String userid;
| private Address addressByLocalAddress; //<---- correct, different names
| private Address addressByRemoteAddress; //<---- correct, different names
|
but in UserHome we have:
| @Name("userHome")
| public class UserHome extends EntityHome<User> {
|
| @In(create = true)
| AddressHome addressHome; //<----- WRONG, SAME NAME
| @In(create = true)
| AddressHome addressHome; //<----- WRONG, SAME NAME
|
I'm using SEAM 2.0 BETA (Hibernate Tools 3.2.0.b9) with ant.
Any clue?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088883#4088883
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088883
More information about the jboss-user
mailing list