Class with mappings to multiple tables generates wrong annotations

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?

Thanks

Hi mserrano,

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.

Best regards,
Jick

Jick,

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.

Thanks,
Martin

Hi mserrano,

Sorry for misunderstanding your problem. But how did you do that? By knowing this, we can try avoid this to happen again.

Best regards,
Jick

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.

vpuml.png

Hello mserrano,

This problem is solved. Please download the patch at:
http://files3.visual-paradigm.com/200706/Patch/sp2_20070621n/VP_Suite_Windows_3_0_sp2_20070621n.exe

Please run the patch and overwrite your existing installation.

Feel free to let me know if you have any comments.

Best regards,
Jick