• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to make an readonly @Entity level in JPA?

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a JPA entity class in which i will be performing only retrieval operation, so how to make read only @Entity level..? Is there any annotations available to achieve it?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

hariharan jayaprakash wrote:how to make read only @Entity level..? Is there any annotations available to achieve it?


It seems there are no specific JPA annotations to achieve this. But some JPA providers have a custom annotation for this purpose (e.g. EclipseLink has the @ReadOnly annotation).

But if the @Entity is read-only, why not create an immutable class yourself and don't provide any set-methods?

Hope it helps!
Kind regards,
Roel
 
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic