Dear community,
First off, my appologies if this has been asked before, but I'm having severe difficulties accessing my varbinary field in a MySQL database:
Field is defined as varbinary(16).
Mapping to POJO byte[] decorated with @Lob annotation.
Code is as follows:
Code:
@Entity
@Table( name = "aim" )
@Cache( usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE )
public class AIM implements Serializable
{
private static final long serialVersionUID = 1810350495885144529L;
@Id
@Column( name = "id" )
@GeneratedValue( generator = "increment" )
@GenericGenerator( name = "increment", strategy = "increment" )
private Long ID;
@Column( name = "is_tracked" )
private boolean isTracked;
@Lob
@Column( name = "alt" )
private byte[] alt;
public AIM() {
}
public Long getID()
{
return ID;
}
public boolean isTracked()
{
return isTracked;
}
public byte[] getAlt()
{
return alt;
}
public void setID( Long ID )
{
this.ID = ID;
}
public void setTracked( boolean isTracked )
{
this.isTracked = isTracked;
}
public void setAlt( byte[] alt )
{
this.alt = alt;
}
This mapping file seems to work partially, as I can use it to get records from the database from this table, and I can then access the simple fields fine, but whenever I try to use the getter for the 'Alt' field, I get a NullPointer Error.
Can anyone shed some light on this for me? I can post more code if necessary.
Thanks in advance, help would be greatly appreciated!
Cheers.