Reputation: 135
Our Hibernate configuration mapping have been implemented programatically in java
, not with annotation
and not with XML
mapping.
We have a mapping classes hierarchy that we're setting in the Hibernate Mappings instance when the context is initialized, for instance:
Mappings mappings = configuration.createMappings();
mappings.addClass(PersistentClass instance);
Now, the issue I'm facing with is quite simple but i don't find an example how to add it for our implementation.
Let's say that
we have 2 tablesA
and B
with Many to one relation,
A.type_id = B.id.
and i want to retrieve all records from A
with the following condition:
A.type_id = B.id and B.id = 4;
How can i add the association (many to one) in my mapping object. org.hibernate.mapping.RootClass.
Upvotes: 1
Views: 5196
Reputation: 400
The question is old, but maybe the answer help someone other.
The topic is to complex to be answered here. Unfortunately the Hibernate documentation does not contain a lot of information and even the source code itself is not documentated at all.
This blog post http://portofino.manydesigns.com/en/blog/configuring-hibernate-programmatically (and the second part of it) gives an overview of how to create the mapping programmatically.
Upvotes: 3