Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsDynamic JPA and AttributeOverrides
https://www.eclipse.org/forums/index.php/mv/msg/296501/804538/#msg_804538
For e.g I have a type "Employee" having two attributes of embedded type "MyType".
Employee {
@Embedded
public MyType t1;
@AttributeOverrides({
@AttributeOverride(name = "DBCOL"})
@Embedded
public MyType t2;
}
I was able to create the embedded type mapping using "addAggregateObjectMapping" but havent found way to override the database mapping using Dynamic API.
Is this possible in Dynamic JPA ?]]>Sunil Varma2012-02-22T18:49:18-00:00Re: Dynamic JPA and AttributeOverrides
https://www.eclipse.org/forums/index.php/mv/msg/296501/808359/#msg_808359
For the API, you can call addMapping() and pass an AggregateObjectMapping.
It contains the API addFieldNameTranslation() which allows the column names to be overridden.
]]>James Sutherland2012-02-27T17:45:40-00:00Re: Dynamic JPA and AttributeOverrides
https://www.eclipse.org/forums/index.php/mv/msg/296501/809821/#msg_809821
In the code below Iam expecting "EMD_ATTR2.JsonString" to use the db mapping "db_jsonstring_2" but it reverts to "db_jsonstring".
//////START CODE
configureEmbeddable(emdType);
....
dynType.addAggregateObjectMapping("EMD_ATTR", emdType.getType(), false);
AggregateObjectMapping mapping = dynType.addAggregateObjectMapping("EMD_ATTR2", emdType.getType(), false);
mapping.addFieldNameTranslation("db_jsonstring_2","JsonString") ; //overriding here
mapping.addFieldNameTranslation("db_jsonstring","db_jsonstring_2") ;]]>James Sutherland2012-03-01T15:36:28-00:00Re: Dynamic JPA and AttributeOverrides
https://www.eclipse.org/forums/index.php/mv/msg/296501/810908/#msg_810908
Sunil Varma2012-03-01T17:10:16-00:00Re: Dynamic JPA and AttributeOverrides
https://www.eclipse.org/forums/index.php/mv/msg/296501/813714/#msg_813714
Ensure you define the parent and child descriptors together.
There could be an issue with how Dynamic JPA does initialization, which you may wish to log a bug on.
Does it work if you use an orm.xml instead of the API?
]]>James Sutherland2012-03-05T16:29:17-00:00Re: Dynamic JPA and AttributeOverrides
https://www.eclipse.org/forums/index.php/mv/msg/296501/825412/#msg_825412
Thanks for your help in resolving this.]]>Sunil Varma2012-03-20T20:24:03-00:00