It is probably simplest if we add byte[] as a mapped type inside TranQL as that will result in the bytes being written to the LOB rather than having it serialize an array object. I will try to add that mapping over the weekend.

Having said that, the Serializable converter should work if you are inserting the LOB using the EJB (and not directly through JDBC). The stack you sent is from when we decided to roll the transaction back, there should be another stacktrace in the log showing the true root cause - can you post that one please.

--
Jeremy

Stefan Schmidt wrote:
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
/

Reply via email to