You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Davide Bruzzone <Da...@ngt.com> on 2003/03/20 00:03:08 UTC

Trouble with 1:n relationships!?...

Greetings all...

I'm trying to set up a simple 1:n relationship where object A contains a
Vector of object Bs. I've read through the documentation, and as far as
I can tell, I've set everything up correctly:

- Object A contains a Vector called objectBs (hypothetically).
- Object B contains an aId attribute. This is an int.
- I've created the two tables in the database... The B table contains a
a_id field. This is an INTEGER (I'm using PostgreSQL by the way). I've
populated both tables, and have confirmed that the data is, in fact,
there (by running the appropriate SQL statements manually).
- I've set up repository_user.xml as follows:

<class-descriptor class="com.foo.A" table="A">
	...
	<!-- Comment -->
	<collection-descriptor...>
		A m:n relationship that is working fine goes here
	</collection-descriptor>
	<!-- Another comment -->
	<collection-descriptor name="objectBs"
element-class-ref="com.foo.B">
		<inverse-foreignkey field-ref="aId"/>
	</collection-descriptor>
</class-descriptor>

<class-descriptor class="com.foo.B" table="B">
	...
	<field-descriptor id="2"
		name="aId"
		column="a_id"
		jdbc_type="INTEGER"/>
	...
</class-descriptor>

Having done this, no B-related data comes back! As I said, if I execute
"select * from b where a_id = whatever", I get data back. Additionally,
the rest of object A comes back fine.

I've tried to look through the mailing list archives, but the
archives/search capability seems to be down.

Any suggestions would be greatly appreciated... My level of frustration
is high! Particualrly as I've managed to implement all the multi-level
m:n relationships that I need without any problems... Now I'm stuck
getting a silly 1:n relationship to work... :-/

Cheers...

Davide Bruzzone

resetting an object to persistence store state.

Posted by Yuji Shinozaki <ys...@virginia.edu>.
What is the best way to reset an object to reflect its persisted state?

Yuji Shinozaki	                        Computer Systems Senior Engineer
ys2n@virginia.edu			Advanced Technologies Group
(804)924-7171				Information Technology & Communication
http://www.people.virginia.edu/~ys2n    University of Virginia