• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Read-only view entities

 
Ranch Hand
Posts: 106
Hibernate Python MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an entity class based on a view, which is supposed to be read-only. I already made all column properties "insertable = false, updatable = false". I also removed all setters, as they don't make sense. Would it make sense to also declare all properties as final? I'd say so...

Karsten
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. I'd be trying to make it as clear a possible to developers that this entity is not for changing. However, I'm not sure if this will work. The way most ORMs work is to instantiate an instance of a class, then set property values. If properties are final, this is not going to work.
 
Karsten Wutzke
Ranch Hand
Posts: 106
Hibernate Python MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just realized that having no setters on my read-only entity classes would violate against the JavaBean spec saying every bean needs a getter AND setter. Is there a problem with that?

BTW: with "view entities" I really mean a DB view, which is made to be read-only - at least in my case.

Karsten
reply
    Bookmark Topic Watch Topic
  • New Topic