[jboss-user] [EJB 3.0] - Update exiting BLOB does not work
CarstenRudat
do-not-reply at jboss.com
Tue Jan 15 08:10:55 EST 2008
Hi all,
I have a problem updating a existing or null BLOB. I run jboss-4.2.1.GA (all-config) with its EJB3 implementation and MySQL 5.x with mysql-connector-java-5.0.7-bin.jar-driver.
I have an entity Signature with a unidirectional relationship to Image (which holds the BLOB):
| public class Signature ...
|
| @OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch = FetchType.EAGER)
| @JoinColumns({
| @JoinColumn(name="image_id_fk", referencedColumnName="id")
| })
| public com.genloop.base.ImageImpl getImage() {
| return this.image;
| }
|
|
| public class Image ...
|
| @Lob
| @Column(name = "image", columnDefinition="MEDIUMBLOB")
| //@org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.NONE) -> I tried this
| public java.sql.Blob getImage() {
| return this.image;
| }
|
In a SLSB, I try a entityManager.merge(aSignagure) and all changes of Signature and Image (e.g. a field "fileName") will update to the DB, except. The BLOB.
I have done a little debugging and I saw, that the getImage() was not called after entityManager.merge(). Then I can see something about XYZLoader that (I think so...) fills the entity-bean with the data of the database. This trace calls setImage(Blob) with the old BLOB or (if it was null) with null.
What could I do?
Thanks,
Carsten
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120058#4120058
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120058
More information about the jboss-user
mailing list