I have two related tables: MANY and ONE. The ONE_ID column in the MANY table formalizes many-to-one relationships.
I want to map objects of many and one domain and create Hibernate to generate DDL, including restricting the foreign key to MANY.ONE_ID. But I want a simple pair of getter and setter ("int getOneId () / void setOneId (int)") on the Many Many object, and not the association methods that Hibernate usually expected from me ("One getOne () / void setOne (one) "). Is it possible?
I will try to explain why I want this: I actually have hundreds of such diverse associations for which I want an FK restriction, but I will never need to navigate. The hibernation mapping file and domain objects must be generated using code generation. All I have to do at runtime is to read the FK property from the "large" side object and set it; I never really need to navigate through multiple associations. Due to problems with code generation, this would greatly simplify the situation if I had simple accessors based on properties for the FK field.
source
share