I created a simple class and mapping attributes to two different db entities in the ORM mapping diagram. The generated code has the wrong annotations. It just assumes all the columns are in the second entity. The java persistence API supports a class being persisted in multiple tables using the @SecondaryTable annotation.
The tool should either generate the right annotations or prevent the user from mapping attributes to more than one table.
Do you plan to support this?
Thank you for your post. One attribute can only be mapped with one column in an entity. Would you mind suggesting how you can map 1 attribute to multiple columns? I will ask our team to avoid that to happen.
I wasn’t referring to mapping one attribute to multiple columns. I was referring to mapping two attributes in the same class to columns in two different tables.
Sorry for misunderstanding your problem. But how did you do that? By knowing this, we can try avoid this to happen again.
I just used the UI on the ORM diagram. I dragged a connection from one attribute to a column on an entity and then I dragged a connection from another attribute to a column on a different entity.
I’ve attached an image.
This problem is solved. Please download the patch at:
Please run the patch and overwrite your existing installation.
Feel free to let me know if you have any comments.