• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

different betwenn property based and field based persistance

 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the different betwenn property based and field based persistance ?
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Samanthi,

the actual differences may depend on the specifics of the O/R technology you are using.

When using JPA or Hbernate two differences which come to mind quickly are that it's all or nothing - if you choose field based persistence usually ALL fields are managed (by default), if you choose to use property based persistence all property accessors are persisted (by default). Depending on the interals (fields) and externals (properties) of your class it may be easier to use one or the other.

Another more important difference is that a getter/setter method can do more than just setting or getting a field value. If this makes sense for the application in question it may be better to use property based persistence.


Marco
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic