javahibernatejpatransientjpa-annotations

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?


Solution

  • 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;