[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - two database, persistence units, relation between the two
hartfordd
do-not-reply at jboss.com
Mon Oct 29 16:49:54 EDT 2007
Hey all,
I have to completely different databases (an oracle and mysql). I want to create two entities that have mapped relations between the two. There is no way to modify the databases, this is what it is.
jboss 4.2.1, ejb3, jpa (not hibernate-specific, although if there is a way with extensions let me know)
oraEntity:
ora_name_PK, first_name
mysqlEntity:
my_name_PK, last_name
oraEntity is in the "ora-pu" persistence unit.
mysqlEntity is in the "mysql-pu" persistence unit.
What I want to do is create the relation between the two entities, in this case only care about many first names for one last name:
======
@OneToMany(mappedBy="ora_name_PK")
private Set oraCollection;
public Set getOraCollection() {
return this.oraCollection;
}
public void setOraCollection(Set oraCollection) {
this.oraCollection= oraCollection;
}
======
So, now, when I try to call from my "mysql-pu", since that has the mysqlEntity and the last-name, I try to use the mysqlEntity.getOraCollection() -- it throws database errors saying the Oracle-associated databases do not exist.
How does one solve this problem?
Google, jboss forums, java-sun-forum, none of them make it easy to search for this problem, so sorry if this is a commonly asked problem but I just can not find the solution.
fyi - I've been using jboss since 3.2 days...but had to create a new forum user after much hassle :-/
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100004#4100004
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4100004
More information about the jboss-user
mailing list