Reveng.hibernate.xml meta tag attributes are visible in hbm2java ftl templates for auto-generated @Embeddable class?

Hello, everyone,

I am using reverse engineering Hibernate (hbm2java) via Maven and hibernate.reveng.xml.
One of my tables has a primary key consisting of two fields.

I would like to add a custom annotation to one of these fields.

<table schema=“biva” name=“tbiv09_con_eve” class=“it.test.prod.entity.EventConnected”>
     <meta attribute=“test”>my value</meta>
</table>

Since I use the meta tag to customize the generation of my entity files, using modified ftl templates (taken from hibernate-tools-orm-X.X.x.Final.jar) I would have liked to do that here as well.

But unfortunately I have a problem, I can’t display or check for the presence of a meta tag within an autogenerated class annotated with @Embeddable, for example EventConnectedId

If I add this line in PojoFields.ftl

==><#if pojo.hasMetaAttribute(“test”)>OK!</#if><==

And try to check the generated entity EventConnected, I have correctly:

==>OK!<==

But, if I check EventConnectedId:

==><==

Is it a bug? Is it an intended behavior?
Is there a way to be able to use the meta tag in this context?

Thanks,
Francesco

If you are using Hibernate for reverse engineering (hbm2java) and your table has a composite primary key consisting of two fields, don’t worry.
Create a class that contains all the fields from your Entity class. Add the @Id annotation to each field in the class. This method is easier if you don’t want to create a separate class for the key.

Remember to configure hibernate.reveng.xml to generate the correct annotations. This file contains special tags for configuring table and key processing.

If you run into any issues, check out this link: https://stackoverflow.com/questions/tagged/hbm2java.