Make Hibernate ignore instance variables that are not mapped
JPA will use all properties of the class, unless you specifically mark them with @Transient
:
@Transient
private String agencyName;
The @Column
annotation is purely optional, and is there to let you override the auto-generated column name. Furthermore, the length
attribute of @Column
is only used when auto-generating table definitions, it has no effect on the runtime.
What is the easiest way to ignore a JPA field during persistence?
@Transient
complies with your needs.
How to make Hibernate ignore a method?
Add @Transient
to the method then Hibernate should ignore it.
To quote the Hibernate Documentation:
Every non static non transient property (field or method depending on the access type) of an entity is considered persistent, unless you annotate it as
@Transient
.
Related Topics
Tomcat - Maxthreads VS Maxconnections
Find the Most Popular Element in Int[] Array
Where Is the Correct Location to Put Log4J.Properties in an Eclipse Project
"Noclassdeffounderror: Could Not Initialize Class" Error
How to Split a Text into Sentences Using the Stanford Parser
How to Convert Double[] to Double[]
How to Copy Data from File to Postgresql Using Jdbc
Is There a Java Library to Access the Native Windows API
Why Is This Java Code in Curly Braces ({}) Outside of a Method
Stop Scheduled Timer When Shutdown Tomcat
Which Loop Has Better Performance? Why
Block()/Blockfirst()/Blocklast() Are Blocking Error When Calling Bodytomono After Exchange()
Access to File Using Java with Samba Jcifs