I'm using JPA with Hibernate. For the entities defined in my app, I use annotations, but some of the entities come as third-party code without any mappings. Therefore I have to map them via XML (at least I think I have to):
<entity-mappings ...>
<access>FIELD</access>
<mapped-superclass class="com.acme.common.model.Request">
<attributes>
<id name="id"/>
</attributes>
</mapped-superclass>
</entity-mappings>
Since this is JPA mapping, it works great except for one case where I have to use a Hibernate specific custom type to map PostgreSQL's uuid type to java.util.UUID.
Using annotations, it's a piece of cake:
@Entity
public class Partner {
@Id
@Type(type = "org.hibernate.type.PostgresUUIDType")
private UUID id = IdGenerator.generate();
}
The problem is that I can't figure out how to do the same via XML.
I considered using Hibernate's native XML mapping, but it seems like it doesn't support mapped superclasses.