-->
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.  [ 3 posts ] 
Author Message
 Post subject: JPA Entitity and variable default value
PostPosted: Wed May 21, 2008 7:21 am 
Newbie

Joined: Tue Nov 27, 2007 5:29 am
Posts: 9
If I have an entity called person;
Code:
@Entity
public class Person {

private String name;

@Column()
   public String getName() {
      return this.name;
   }

+setters



Is there some limitations to use initial value for that name variable?
(As in private String name = "FooBar)


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 21, 2008 10:51 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
Is there some limitations to use initial value for that name variable?

AFAIK there are no limitations about that, you could even have some logic in your getters; this question is more about design: some people like it, others think it's bad.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 22, 2008 9:56 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
I'd have to see the code a little more to know exactly what you're doing, but as it stands, I don't see any issues.

Don't forget to specify an @Id!

-Cameron McKenzie

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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