-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: @Formula and Java enums - is it possible?
PostPosted: Fri Apr 13, 2007 6:44 am 
Beginner
Beginner

Joined: Wed Sep 06, 2006 12:08 pm
Posts: 48
Location: Warsaw - Poland - Europe - Milky Way
Good morning

I am using the latest Hibernate versions (Hibernate Core 3.2.3 and Hibernate Annotation 3.3.0).

QUESTION:
Is it possible to use in conjunction Java enums and Hibernate Formula mechanism?

In other words is it possible to get something like this:

Code:
public enum Day
{
   MONDAY,
   TUESDAY
}


and ...:
Code:
public class MyEntity
{
...
Day day;

   @Formula("CASE" +
         " WHEN NUM=1 THEN 'MONDAY'" +
         " WHEN NUM=2 THEN 'TUESDAY'"   +
         " END")
   public Day getDay()
   {
      return day;
   }

...
}

Unfortunately I cannot get it work for me.

Kind regards,
Adam Woźniak


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.