users@glassfish.java.net

BUG: TopLink Essentials can not deal with Blob on PostgreSQL 8.2

From: <glassfish_at_javadesktop.org>
Date: Sat, 12 Jan 2008 20:31:58 PST

My TopLink Essentials' version is Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007). My entity is :

@Entity
public class Employee {

String id;
String name;
byte[] photo;

@Id
@Column(name = "id")
@GeneratedValue
public String getId() {
return id;
}

public void setId(final String id) {
this.id = id;
}

public void setName(final String name) {
this.name = name;
}

@Column(nullable=false)
public String getName() {
return name;
}

@Lob
public byte[] getPhoto() {
return photo;
}

public void setPhoto(byte[] photo) {
this.photo = photo;
}


}

When inserting an employee object such as Employee[id=2, name=tom], error happens:

Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: column "photo" is of type bytea but expression is of type oid
Error Code: 0
Call: INSERT INTO EMPLOYEES (id, NAME, PHOTO) VALUES (?, ?, ?)
bind => [2, tom, null]
Query: InsertObjectQuery(Employee[id=2, name=tom])
at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:311)
[Message sent by forum member 'easyjava' (easyjava)]

http://forums.java.net/jive/thread.jspa?messageID=253575