Solved it but its a bit of a pain..
You need to set the column type to blob (in mysql) but the hibernate type to binary.. So if you're generating the the sql from the mapping files then its a bit of a mess.
/** * @hibernate.property column="image" type="binary" */
this generates a column of type varchar length 255 with the binary option, i changed the column type to blob and it seems to deal with life.. I guess i'll need to write a correction script or something.
But in terms of programming everything behaves as one who expect of a OM framework (i.e makes life easier rather than adding addition complication)
To be fair the hibernate docs do say that blob support is patchy between vendors.
mark
On 30 Jul 2004, at 12:30, Mark Lowe wrote:
Hi Bryan
Just downloaded the latest, but the action just prints a test message..
System.out.println("at least i managed to get called");
The problem isn't with form file, thats fine.. Its when I try and save to the db
//hibernate stuff
/** * @hibernate.property column="image" type="blob" */ public byte[] getImage() { return image; }
public void setImage(byte[] image) { this.image = image; }
Now i created a custom user type like were required with older versions of hibernate..
/**
* @hibernate.property column="image" type="com.sparrow.hibernate.type.Image"
*/
http://www.hibernate.org/73.html
but when i try and save now i get a null pointer exception with not much else to go on (before it was a class cast exception). I'd have thought that creating a custom user type was a bit old hat as 2.0 loved it..
The only other thing i can think its down to is the jdbc driver.. Which i'm investigating now.
On 30 Jul 2004, at 12:08, Bryan Hunt wrote:
My app is able to do it no problem, back and forth.
You can get the source code from http://jestate.revoltingdigits.com/
ie.jestate.struts.action.ImageUploadAction
My code is a mess at the moment but that code is working.
--b
Mark Lowe wrote:
I've had the same thing happen using DBCP and C3PO, I believe its the driver rather than the pooling. As I said we've a app thats live, and i haven't touched it in months using DBCP.
[OT] subject change.. Have you had any joy with byte[] to blob mapping for file uploads with hibernate 2.1.4? I created a custom usertype, but i get a npe. 2.0 delbt with life, but things appear to have taken a step backwards. (please dont make me go the the scary hibernate forum :) )
On 30 Jul 2004, at 11:34, Joe Hertz wrote:
I noticed this behavior with 3.0.14.
This _really_ sounds like this entry in the Hibernate FAQ to me:
http://www.hibernate.org/117.html#A13
I wouldn't use DBCP though as Gavin King is apparently fed up with it,
and built-in support for it is being yanked in the next major version of
Hibernate.
-----Original Message----- From: Marco Mistroni [mailto:[EMAIL PROTECTED] Sent: Friday, July 30, 2004 5:08 AM To: 'Struts Users Mailing List' Subject: RE: OT/ Tomcat, Hibernate and MYSQL problem
Hello, If I remember correct, mysql connector 3.0.11
Regards marco
-----Original Message----- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: 30 July 2004 09:36 To: Struts Users Mailing List Subject: Re: OT/ Tomcat, Hibernate and MYSQL problem
Marco
What jdbc driver are you using?
They was a shady version 3 behaving like this.
On 30 Jul 2004, at 10:05, Joe Hertz wrote:
Hibernate's internal connection pooling isn't meant for production because it does things just like that.
Suggest you use c3p0 for the pooling.
From my hibernate.cfg.xml, I only had to add this:
<property name="c3p0.minPoolSize">5</property> <property name="c3p0.maxPoolSize">20</property> <property name="c3p0.timeout">1800</property> <property name="c3p0.max_statement">50</property>
HTH
-Joe
-----Original Message----- From: Marco Mistroni [mailto:[EMAIL PROTECTED] Sent: Friday, July 30, 2004 3:58 AM To: 'Struts Users Mailing List' Subject: OT/ Tomcat, Hibernate and MYSQL problem
Hello,
First of all, I apologize for the off topic issue.. I know this is not the list, but I tried hibernate forums, and Searched the web with no solution.. hopefully some of u
had the Same
problem and solved it..
I m experiencing problems with Hibernate in tomcat,
talking to mysql.
My situation is that I didn't define any connection pools
in tomcat,
but left it to Hibernate to handle that...
After leaving the application running for 11 hours, I got
following
exception
hi all, i have a webapp taht uses Hibernate and MYSQL, running on top of tomcat.
i am letting Hibernate handle the connections to mysql db, since i
have no connection pools defined in tomcat. after running the
application for nearly 9 hours, when i tried to use my app
to connect
to the database i got following exception:
Caused by: net.sf.hibernate.JDBCException: Could not
execute query at
net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1476) at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:45) at com.myapp.hibernate.HibernatePersistenceManager.query(Hibernat ePersisten ceManager.java:205) ... 31 more Caused by: java.sql.SQLException: Communication link failure: java.net.SocketException, underlying cause: Software caused
connection
abort: recv failed
** BEGIN NESTED EXCEPTION **
java.net.SocketException MESSAGE: Software caused connection abort: recv failed
STACKTRACE:
java.net.SocketException: Software caused connection abort: recv failed
now i have searched the web and found two possible
alternatives.. one
was to add following problems to hibernate config file.. <property
name="connection.autoReconnect">true</property>
<property name="connection.autoReconnectForPools">true</property>
<property
name="connection.is-connection-validation-required">true</ property>
but this does not work, as ihave added thos eproperties to
hibernate
properties file and i am still getting same exception
then I tried to add ?autoReconnect=true to JBDC URL, but
that didn't
------------------------------------------------------------------- --work either coz I left application running for 11 hours and after that I got same exception...
can anyone help me out?
THANX in advance and regards marco
l: [EMAIL PROTECTED]
------------------------------------------------------------------- --To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
------------------------------------------------------------------- --
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
------------------------------------------------------------------- --
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-------------------------------------------------------------------- -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]