• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate - Simple mapping to object

 
Craig Taylor
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recently modified a field that had previously been mapped as an Enum String to a Class and am having problems finding the proper definition to inform Hibernate of the class.

The error I'm receiving is :


Whereas for enumerations I had a defintion similair to (using annotations):
;

I'm attempting to use something like :


I have ensured that I have a String constructor for the FieldObjectType class.

The only way I can possibly see of doing it is to write my own UserType - yet I feel like this should be a common case that may have a quicker solution.

Thanks,
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Embedded is the annotation that you use for mapping a component object, or a <component> tag in Hibernate XML mappings.
 
Craig Taylor
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, perfect - just what I needed.

I had gotten around it temporarily by creating my own proxied @Temporal fields that would create the object but this looks like a much better approach.

Thanks,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic