-->
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.  [ 5 posts ] 
Author Message
 Post subject: EnumType.STRING unknown values
PostPosted: Thu Mar 20, 2008 1:33 am 
Newbie

Joined: Thu Mar 20, 2008 1:27 am
Posts: 5
Hi,

We are doing staged releases to our production environment and at points we will have two different versions of our code running.

If we add new Enum values into a version - the old version has problems running because it starts getting exceptions with unknown values when it is trying to map these enums.

Is there a way so we can tell hibernate to ignore enums which can't be mapped so we can keep running both versions?

Thanks,
Alvin


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 22, 2008 12:58 am 
Newbie

Joined: Thu Mar 20, 2008 1:27 am
Posts: 5
Anyone?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 22, 2008 4:33 am 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
you could replace the table by a view that hides the new values ...
Or you could define such filter in hibernate (I think) check out WHERE and FILTER Attributes

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 25, 2008 12:43 am 
Newbie

Joined: Thu Mar 20, 2008 1:27 am
Posts: 5
I solved the issue via AOP - however this is not the ideal solution.


Code:
@Component
@Aspect
public class TestAOP {

   @Around("execution(* org.hibernate.type.EnumType.nullSafeGet(*,*,*))")
    public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable {
      try {         
          Object retVal = pjp.proceed();
          return retVal;
      } catch (IllegalArgumentException e) {
      }
      return null;
     }
}


Last edited by alvins82 on Tue Mar 25, 2008 12:44 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 25, 2008 12:43 am 
Newbie

Joined: Thu Mar 20, 2008 1:27 am
Posts: 5
..duplicate.


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

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.