-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with properties
PostPosted: Mon May 14, 2007 9:54 am 
Newbie

Joined: Mon May 14, 2007 9:50 am
Posts: 1
Hi, I have a simple class:

namespace TestHibernate
{
public class TestClass
{
private int i;
private int a;

public int A
{
get { return a; }
set { a = value; }
}

public int I
{
get { return i; }
set { i = value; }
}
}
}

and I`m getting an exception while trying to create SessionFactory:
The following types may not be used as proxies:
TestHibernate.TestClass: method set_I should be virtual
TestHibernate.TestClass: method set_A should be virtual
TestHibernate.TestClass: method get_I should be virtual
TestHibernate.TestClass: method get_A should be virtual


Do you have any idea what may be wrong?

Thank you very much in advance for any help


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 10:37 am 
Regular
Regular

Joined: Tue Jan 03, 2006 11:43 am
Posts: 51
Location: Sweden
You have to declare the properties virtual (or make the class lazy=false in mapping file). So have public virtual int A for example.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.