bozo
bozo

Reputation: 946

Caching read-only entity beans in EJB 3.1

How do I go about marking an entity bean (let us say that I have an "Country" entity bean which holds a record about a country that never changes) read-only on a Glassfish 3.1 with EJBs 3.1?

There seems to be a way to mark column immutable, but information is very scarce and whatever I tried didn't really work.

Any ideas?

Upvotes: 0

Views: 490

Answers (1)

Oliver
Oliver

Reputation: 4183

Using EclipseLink you can use the JPA exensions of EclipseLink and put the @ReadOnly on the entity. For query you can add the query hint READ_ONLY to the query:

query.setHint(QueryHints.READ_ONLY, HintValues.TRUE);

For details on this, see http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#Using_EclipseLink_JPA_Extensions_for_Declaration_of_Read-Only_Classes

and

http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#Read_Only

Upvotes: 1

Related Questions