-->
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: @Transient and Second Level Cache
PostPosted: Tue Jul 12, 2011 7:24 am 
Newbie

Joined: Fri Apr 11, 2008 7:33 am
Posts: 3
Hallo,
I am using an Hibernate and JBoss Cache as second level cache. The example entity has an @Transient field number:

Code:
@Entity
public class Foo {
   @Column(length=20)
   private String name;
   
   @Transient
   private Integer number;
}


TestCode:
Code:
   Foo foo = new Foo();
   foo.setName("Paul");
   foo.setNumber(Integer.valueOf(55));
   foo = entityManager.persist(foo);
   Assert.assertEquals(55, foo.getNumber().intValue());

The assertion fails because foo.getNumber() is null. This is a reasonable behavior if you think about persisting an object. If you look the other way, putting something into a cache an read it again, this behavior is strange.

Is there a way to configure Jboss Cache/Hibernate to change this behavior?
I am using Jboss Cache (1.4.1.SP9), Hibernate 3.2.1 from within JBoss AppServer 4.2.3

Thanks for your help.

Viktor


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.