logo       

access a BLOB coloumn from a CMP EJB: msg#00077

java.geronimo.user

Subject: access a BLOB coloumn from a CMP EJB

Hi,

I am trying to access a (MySQL) MEDIUMBLOB coloumn from a CMP EJB. There are some tips @ Wiki but I still can't figure it out.

Here are my artefacts:

openejb-jar.xml:

<cmp-field-mapping>
<cmp-field-name>image</cmp-field-name>
<table-column>image</table-column>
<sql-type>BLOB</sql-type>
<type-converter>org.tranql.sql.typeconverter.SerializableConverter</type-converter>
</cmp-field-mapping>


CMP EJB fields:

public byte[] getImage();

public void setImage(byte[] image);


When trying to access this coloumn from my Session EJB :

book.getImage();

I get:

javax.transaction.TransactionRolledbackException: Unable to load data for field
at org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:126)
at org.openejb.transaction.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:80)
at org.openejb.SystemExceptionInterceptor.invoke(SystemExceptionInterceptor.java:82)
at org.openejb.GenericEJBContainer.invoke(GenericEJBContainer.java:234)
at org.openejb.proxy.EJBMethodInterceptor.intercept(EJBMethodInterceptor.java:129)
at org.openejb.proxy.EntityEJBObject$$EnhancerByCGLIB$$227af363.getImage(<generated>)
at com.ibm.dw.bookshop.ejb.BookShopBean.getBooks(BookShopBean.java:135)
...

Do I have to write my own /Type**Converter to get it right?

Could anyone provide a short example on this (preferably write it on the wiki so everyone can see it)?

The wiki link: http://wiki.apache.org/geronimo/Working_with_Enterprise_JavaBeans

Thanks,

Stefan
/



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise