You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by David Wynter <da...@roamware.com> on 2002/11/07 14:40:46 UTC

Criteria.CUSTOM error and how to display BLOB as string

Hi,

I need to do a sub query in my criteria thus

// Now get views that have this database as a FK and have records
Criteria crit = new Criteria();
crit.add(RwViewPeer.RW_VIEW_ID, (Object)"RW_VIEW_ID IN (SELECT
DISTINCT(VIEW_ID) FROM RW_RECORD)", ((String)criteria.CUSTOM));
crit.add( RwViewPeer.DATABASE_ID,
KeyConverter.intFromNumberKey(rwDatabase.getRwDatabaseId()));
returnList = RwViewPeer.doSelect(crit);

The extra cast is to try to get stupid JBuilder to stop giving me this
error. It doesn't

"EntityListTool.java": Error #: 304 : reference to add is ambiguous; both
method add(java.lang.String, java.lang.Object, java.lang.String) in class
org.apache.turbine.util.db.Criteria and method add(java.lang.String,
java.lang.String, java.lang.Object) in class
org.apache.turbine.util.db.Criteria match at line 555, column 18

the problem is that I can only compile using 'ant compile' now and thus
cannot trace in JBuiilder to see more detial on  the exception in the method
that has the above code in it. Thus why I produce the code excerpt here, I
cannot see anything wrong with it. If I remove just the line with the
Criteria.CUSTOM it compiles and the doSelect runs just fine.

Ideas?

Another question, having just switched from Oracle to MySQL I had to change
one column from '..size="4000" type="VARCHAR"' for Oracle to
'..type="BINARY"' for MySQL. The former converts to a VARCHAR2(4000( and the
latter to a BLOB. Now when I put the object with this attribute into the
context how do I convert from a BLOB to a string for display?

Thanks

David Wynter

roamware Ltd.
(+44) (0) 208 922 7539 B.
(+44) (0) 7879 605 706 M.
david@roamware.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Criteria.CUSTOM error and how to display BLOB as string

Posted by David Wynter <da...@roamware.com>.
Hi,

I changed the data type to LONGVARCHAR which gives me a MySQL data type of
MEDIUMTEXT. But this still displays as binary data in the textarea HTML
object. Cannot find anything in the turbine user or velocity user archives
on this.

And yes, it was a typo in the original message it is Criteria.CUSTOM not
criteria.CUSTOM as was shown.

David
-----Original Message-----
From: David Wynter [mailto:david@roamware.com]
Sent: 07 November 2002 13:41
To: Turbine-User
Subject: Criteria.CUSTOM error and how to display BLOB as string


Hi,

I need to do a sub query in my criteria thus

// Now get views that have this database as a FK and have records
Criteria crit = new Criteria();
crit.add(RwViewPeer.RW_VIEW_ID, (Object)"RW_VIEW_ID IN (SELECT
DISTINCT(VIEW_ID) FROM RW_RECORD)", ((String)Criteria.CUSTOM));
crit.add( RwViewPeer.DATABASE_ID,
KeyConverter.intFromNumberKey(rwDatabase.getRwDatabaseId()));
returnList = RwViewPeer.doSelect(crit);

The extra cast is to try to get stupid JBuilder to stop giving me this
error. It doesn't

"EntityListTool.java": Error #: 304 : reference to add is ambiguous; both
method add(java.lang.String, java.lang.Object, java.lang.String) in class
org.apache.turbine.util.db.Criteria and method add(java.lang.String,
java.lang.String, java.lang.Object) in class
org.apache.turbine.util.db.Criteria match at line 555, column 18

the problem is that I can only compile using 'ant compile' now and thus
cannot trace in JBuiilder to see more detial on  the exception in the method
that has the above code in it. Thus why I produce the code excerpt here, I
cannot see anything wrong with it. If I remove just the line with the
Criteria.CUSTOM it compiles and the doSelect runs just fine.

Ideas?

Another question, having just switched from Oracle to MySQL I had to change
one column from '..size="4000" type="VARCHAR"' for Oracle to
'..type="BINARY"' for MySQL. The former converts to a VARCHAR2(4000( and the
latter to a BLOB. Now when I put the object with this attribute into the
context how do I convert from a BLOB to a string for display?

Thanks

David Wynter

roamware Ltd.
(+44) (0) 208 922 7539 B.
(+44) (0) 7879 605 706 M.
david@roamware.com


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>