This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes CompositeUserType Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "CompositeUserType" Watch "CompositeUserType" New topic


Megan Mathew

Joined: Jan 16, 2012
Posts: 1
I have a requirement where an entity can have both static and customizable part. The customizable part will be in the form of a Map within the entity. I used the CompositeUserType to handle this. The issue I am now facing is that it checks the number of columns configured in the entity with the number of columns available at run time, which in my case, will not match. This causes a wrong number of columns exception to be thrown.

If I use a Contact.hbm file

This will work, irrespective of what string is given as the column name for customProperties, as long as it is the correct number as the objects in the Map.

My issue is that, I know the number of columns only at runtime, and I need to use annotations instead of hbm files.

Please help.
I agree. Here's the link:
subject: CompositeUserType
Similar Threads
Many-to-many composite ID
Foreig key must have same number of columns as the referenced primary key
1-to-M mapping confusion
Association references unmapped class exception with hibernate
java.lang.ClassNotFoundException: javax.persistence.JoinTable