Thanks a lot for your help.
But my scenario looks a little bit different to yours.
I think it is the best way when I give you further information.
The database schema looks like this:
Code:
CREATE TABLE foo (
foo_id int unsigned( 10 ) NOT NULL,
name VARCHAR( 45 ) NOT NULL,
CONSTRAINT pk_foo PRIMARY KEY(foo_id));
CREATE TABLE info (
info_id int unsigned( 10 ) NOT NULL,
information VARCHAR( 45 ) NOT NULL,
CONSTRAINT pk_info PRIMARY KEY(info_id)) ;
CREATE TABLE bar (
bar_id int unsigned( 10 ) NOT NULL,
name VARCHAR( 45 ) NOT NULL,
info_id int unsigned( 10 ) NOT NULL,
CONSTRAINT pk_bar PRIMARY KEY(bar_id),
CONSTRAINT FK_bar_1 FOREIGN KEY( info_id ) REFERENCES info ( info_id )) ;
CREATE TABLE foo_bar_map (
id int unsigned( 10 ) NOT NULL,
foo_id int unsigned( 10 ) NOT NULL,
bar_id int unsigned( 10 ) NOT NULL,
CONSTRAINT pk_foo_bar_map PRIMARY KEY(id),
CONSTRAINT FK_FOO_BAR_MAP_1 FOREIGN KEY( bar_id ) REFERENCES bar ( bar_id ),
CONSTRAINT FK_FOO_BAR_MAP_2 FOREIGN KEY( foo_id ) REFERENCES foo ( foo_id ));
I created following classes:
Code:
public class Foo {
private Integer fooId;
private String name;
...
}
public class Bar {
private Integer barId;
private String name;
private Info info;
...
}
public class FooBarMap {
private Integer id
private Foo foo;
private Bar bar;
...
}
public class Info {
private Integer id
private String info
}
Now I created a class where I collect informations about these
classes.
Code:
public class Infodata {
private Integer barId;
private String infoName;
private Set foos;
...
}
Please have a look on it again. How can I create the hibernate xml mapping for the "InfoData" bean?
Sorry, I have forgotten to mention that I have to use Java 1.4 .
So I cannot use annotations :-(. But I think there is no problem to migrate the annotations to the xml mapping.
Thanks in advance.