I've an entity which I recently added a new blob property and I want only that property to be loaded lazily via interception, so I set the lazy attribute of the property mapping true and used the ant task (org.hibernate.tool.instrument.cglib.InstrumentTask) in order to instrument the bytecode of the entity, this is for example:
Class
Code:
...
public class Category implements Serializable {
...
private byte[] image;
...
public byte[] getImage(){
return this.image;
}
public void setImage(byte[] image){
this.image = image;
}
...
}
Mapping
Code:
<class name="app.domain.Category" table="category">
<id name="code" column="code" type="int" unsaved-value="0">
<generator class="native">
<param name="sequence">s_category</param>
</generator>
</id>
...
<property name="level" type="int" column="level" />
...
<property name="image" type="blob" column="image" not-null="false" lazy="true" />
...
</class>
Ant log
Code:
[instrument] starting instrumentation
...
[instrument] accepting transformation of field access [app.domain.Category.code]
[instrument] accepting transformation of field access [app.domain.Category.code]
[instrument] accepting transformation of field access [app.domain.Category.name]
[instrument] accepting transformation of field access [app.domain.Category.name]
[instrument] accepting transformation of field access [app.domain.Category.level]
[instrument] accepting transformation of field access [app.domain.Category.level]
...
[instrument] accepting transformation of field access [app.domain.Category.image]
[instrument] accepting transformation of field access [app.domain.Category.image]
...
[instrument] accepting transformation of field access [app.domain.Category.image]
[instrument] accepting transformation of field access [app.domain.Category.image]
...
[instrument] accepting transformation of field access [app.domain.Category.code]
[instrument] accepting transformation of field access [app.domain.Category.level]
[instrument] accepting transformation of field access [app.domain.Category.name]
...
[instrument] accepting transformation of field access [app.domain.Category.code]
[instrument] accepting transformation of field access [app.domain.Category.name]
...
[instrument] accepting transformation of field access [app.domain.Category.level]
[instrument] accepting transformation of field access [app.domain.Category.code]
[instrument] accepting transformation of field access [app.domain.Category.code]
[instrument] accepting transformation of field access [app.domain.Category.code]
[instrument] accepting transformation of field access [app.domain.Category.code]
...
[instrument] accepting transformation of field access [app.domain.Category.name]
...
How you can see the log shows the properties more than once, its that ok?
The main doubt is why other properties other than the image blob are instrumented?, I just want that property to be instrumented and the other to stay as they has been working.
Any hint will be appreciate