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 and default value

 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a column set up of id, item_id, logo and imagetype. Now I want to add a isDefault value that is used to get the first image for an item. An item can have many images but only one default per imagetype.

itemId and imagetype together can only have one isDefault set to 1 the rest should be o for isDefault. Is there anyway of doing this with Hibernate? This is what I got so far.

 
Chandra Sekhar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure whether this will solve your problem.

To set default value to a column , I had done like this before.

<property name="price" type="string" formula="CASE WHEN (COALESCE(ITEM_CST,0) = 0) THEN ' ' ELSE CHAR(ITEM_CST) END"/>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic