Hibernate 3.0.2
Postgres 7.4
JBoss 4.0.2
Tapestry 3.0.3
I am trying to upload a file from a form in my tapestry webapp. And get the following exception:
Code:
14:15:12,227 INFO [STDOUT] Hibernate: insert into DOCUMENTLOCKER (visibility, document, title, description, filename, type, appinfoid, appverid, assessinfoid, companyid, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
14:15:12,230 ERROR [JTATransaction] JTA commit failed
org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=me.com/53, BranchQual=, localId=53] status=STATUS_NO_TRANSACTION; - nested throwable: (java.lang.IllegalArgumentException: \0 not allowed)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:344)
at org.jboss.tm.TxManager.commit(TxManager.java:200)
at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:126)
at org.hibernate.transaction.JTATransaction.commit(JTATransaction.java:130)
at com.domain.util.HibernateUtil.commitTransaction(HibernateUtil.java:105)
at com.view.pages.AddDocumentationPage.formSubmit(AddDocumentationPage.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
My persistant object that contains a bytea field is called 'locker' the bytea field is named 'document'.
Here is the a portion of my code that I use to attempt to save the file inputstream which is obtained from my upload form:
Code:
HibernateUtil.beginTransaction();
locker.setDocument(ByteUtils.getBytesFromStream(inputstream));
HibernateUtil.saveOrUpdate(locker);
HibernateUtil.commitTransaction();
HibernateUtil.closeSession();
I also have no problems using this same code on a Servlet that I wrote to initialize a few fields in my database.
Any help will be greatly appreciated.