I have two related tables, MANY and ONE. An integer ONE_ID column on the MANY table formalises a many-to-one relationship.
I want to map to Many and One domain objects and to have Hibernate generate the DDL including a foreign key constraint on MANY.ONE_ID. But I want a simple property getter and setter pair ("int getOneId() / void setOneId(int)") on the Many domain object rather than the association methods that Hibernate would ordinarily expect me to provide ("One getOne() / void setOne(One)"). Is this possible?
I'll try and explain why I want this: I actually have hundreds of such many to one associations for which I want the FK constraint but that I'll never need to navigate. The hibernate mapping file and the domain objects are to be created by code generation. All I need to do at runtime is to be able to read the FK property from the 'many' side object and to set it; I never need to actually navigate the many to one association. Because of the code generation issues it would greatly simplify things if I could have simple property based accessors for the FK field.