I have a table named Person. Mapped class looks something like this:
Code:
public class Person implements java.io.Serializable {
private Integer personId;
private String name;
private Long age;
private byte[] photo;
//getters setters omitted
How to move
Code:
byte[] photo
to a separate class that has 1-to-1 association with Person. I want to do this so i could lazy load blob on demand (my db doesn't support lazy loading properties).
currently i have:
Person class hbm:
Code:
<one-to-one class="Photo" name="photo" constrained="true" fetch="select" />
Photo:
Code:
<class name="Photo" table="PERSON" polymorphism="explicit">
<id name="photoId" type="int">
<column length="200" name="PersonID"/>
<generator class="increment"/>
</id>
<property name="blob" type="byte[]">
<column name="Photo" not-null="false"/>
</property>
I can select existing Person records with this, but i cant insert new - Photo value is null in db. Please give some advice.