-->
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: How to ignore a property when using Attributes
PostPosted: Wed Dec 05, 2007 12:55 pm 
Newbie

Joined: Sun Nov 21, 2004 11:12 pm
Posts: 2
I have a class that uses a property that I don't want persisted. I understand that when using a mapping file, I can simply not include that property in the mapping file and it will be successfully ignored.

However, we are using attributes in our classes. Is there an attribute that I can use to tell NHibernate to ignore the property in my class?

For example (albeit a bad example):

[Serializable, Class(Table = "DOGS")]
public class Dog{

private string name;
private bool hasTicks;

[Property(Column = "CORRELATION_LANG_TAG")]
public virtual string name{ get {return name;} set{ name = value;} }


public bool HasTicks{ get {return name.equals("joe");} }
}


How do I decorate the HasTicks property or the hasTicks field such that NHibernate knows to ignore it?

Thanks,
Christian


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 05, 2007 1:11 pm 
Newbie

Joined: Sun Nov 21, 2004 11:12 pm
Posts: 2
I think I figured this out on my own. I simply took out all attributes from the property and kept the property virtual and that did the trick.


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.