Hibernate version: 3.3.1.GA
Mapping documents: -
Code between sessionFactory.openSession() and session.close(): -
Full stack trace of any exception that occurs: -
Name and version of the database you are using: Oracle 10gR2
The generated SQL (show_sql=true): -
Debug level Hibernate log excerpt: -
------------------------------------------------------------------------
Hello,
I have the following (I consider it simple) issue for which I didn't find an example for it:
- starting with two entitities: Profile and Position in a many-to-many relationship;
- the relationship is actually an association with an attribute.
Code:
Profile Position
name --- contains ---> name
... with status ...
and the db tables:
Code:
Profile Profile_Position Position
IDProfile IDProfile IDPosition
Name IDPosition Name
... Status ...
I created Profile and Position as clases, but I want to have another PersonPosition class that will contain the status property.
Person would contain a set of positions:
Code:
private Set<PersonPosition> positions = new HashSet<PersonPosition>();
but I don't know how to design and map the PersonPosition entity since it doesn't have an id of its own: the table "Profile_Position" has a composite primary key consisting in IDProfile and IDPosition. And in the mapping, if I include this as a composite-id, then my "class name=PersonPosition" cannot include a Person and a Position as properties.
I really need a help on this or a simple example that would reflect this association, since it's not a simple many-to-many relation between Profile and Position entities.
Should this be related to the fact that "Hibernate doesn't manage persistent associations. If you want to manipulate an association, you must write exactly the same code you would write without Hibernate." ???
Please, I really need a help since I'm stuck right now.
Many thanks in advance.