Column without member

160 views Asked by At

Using Hibernate we're trying to have it create an additional column to an abstract class - but we can't add a new member to this class (memory consumption in large scale). We need to have Hibernate create the schema (development phase, hibernate.hbm2ddl.auto=update).

Let's say we have a MyClass entity class with members a,b,c, and we would like Hibernate to also create a column d. This column is not needed in memory and will be accessed only via HQL/SQL during saving/loading times of MyClass instances.

Can this be done?

Notes:
1. Hibernate 3.6.0 Final + Oracle 11g + pure Java
2. We use annotations, no xml files

1

There are 1 answers

3
JB Nizet On

Add the property to the class, but make it lazy (using the @Basic(fetch = FetchType.LAZY) annotation).

Make sure your classes are instrumented at build time: it's needed for this to work. More details are available in this chapter of the documentation.