Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate CompositeUserType with repeated field

 
Don Blodgett
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am attempting to create a mapping within Hibernate which requires a CompositeUserType. The user type consists of 2 fields one of the columns is used within a separate composite type. The problem is that I get an error message stating that the repeating column must be set to insert/update to false, unfortunately I am not able to set the individual column to not insert/update. Here is the relevant portion of the mapping.



As can be seen the changed field is used numerous times, but I am not able to disable insert/update of the changed field, which is always handled by the database.

Any assistance is greatly appreciated.
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am attempting to create a mapping within Hibernate which requires a CompositeUserType. The user type consists of 2 fields one of the columns is used within a separate composite type. The problem is that I get an error message stating that the repeating column must be set to insert/update to false, unfortunately I am not able to set the individual column to not insert/update. Here is the relevant portion of the mapping.

-- Can you rephrase this sentence? I'm sorry, I'm not able to understand exactly your requirement.
 
Don Blodgett
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll try. I have a need to provide to the user of this class an object which has some processing done to the 2 objects contained within the database. These two objects are called 'segment1' and 'segment2', the processing I have to do requires the use of the 'changed' field. The changed field is always updated by the database through a trigger on both insert and update and therefore cannot be modified outside of the database. Hibernate fails to map the fields due to the changed columns not being marked insert/update=false and unfortunately the <column> element in the mapping cannot be marked as such (unless I am missing something in the documentation). I am looking for a way to get around this issue.
 
Don Blodgett
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After thinking about this some more I have determined that due to the fact that I do not need to update the created field I can just use a formula instead of accessing the column directly, this fixed my issue.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic