ssdehero
ssdehero

Reputation: 796

Can I fetch existing data for JPA field that newly marked as @Transient?

I have a JPA column that Im GOING to mark as @Transient. But I do have some data in that field that I want to move later.

I know that @Transient won't persist. But, can I still load those existing data to the memory to the Java world?

Upvotes: 1

Views: 652

Answers (1)

Simon Martinelli
Simon Martinelli

Reputation: 36133

No @Transientprevents JPA/Hibernate from any data access operation.

But if you have a field that you only want to read you can mark it read-only:

@Column(insertable = false, updatable = false)
private String transientField;

Upvotes: 4

Related Questions