• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do add a method to a model that doesn't map to the db?

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using the latest version of Hibernate on a Resin 3.0.19 server (Java 1.5). I have a model mapped to a database table. My question is, how do I add a method to the model class that doesn't have anything to do with the database? I tried adding a method ...



and got the following error about creating a new session ...



Any advice is greatly appreciated, - Dave
 
Reehan Lalkhanwar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it should not give you any problems as long as you have not mapped financialAidRemaining.
Are you using mapping files?
Try renaming getFinancialAidRemaining to something else without the getter syntax.
 
Sylvain Bouchard
Ranch Hand
Posts: 41
Java ME Objective C Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dave,

I need more information on this one...
What did you use for the mapping (Hibernate or JPA) (Annotation or XML) ?
How did you configure your Access Type (field or property) ?

If your access type is set to property, it may try to map this method as a mapping.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic