java - Hibernate OneToOne with a specific clause -


if knows how-to:

i have entity

@entity public class anentity {     ...      private string propertya;     private string propertyb;     private string propertyc; } 

and strings propertya, propertyb , propertyc stored in different table refference anentity, name , value fields, like:

@entity public class property {     ...      private string name;     private string value; } 

can specify onetoone joins in anentity clause, i'd have like:

@entity public class anentity {     ...     @onetoone(table = "properties")     @joincolumn("anentity_id")     @wherejointable(name = "propertya")     private string propertya;     ... } 

any appreciated! thanks!

i think easiest way this:

@entity  public class anentity {     @onetomany     @joincolumn("aentity_id")     @mapkey(name = "name")     private map<string, property> properties;     ...     public getpropertya() {         return properties.get("propertya");     }     ... } 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -