Re: Mysql and pk fetches with EOUtil or ERXEOControlUtil. Adaptor bug?
Re: Mysql and pk fetches with EOUtil or ERXEOControlUtil. Adaptor bug?
- Subject: Re: Mysql and pk fetches with EOUtil or ERXEOControlUtil. Adaptor bug?
- From: Chuck Hill <email@hidden>
- Date: Thu, 18 Sep 2008 13:17:06 -0700
On Sep 18, 2008, at 1:06 PM, William Hatch wrote:
Bill
http://web.mac.com/wkhatch
On Sep 18, 2008, at 4:01 PM, Chuck Hill wrote:
On Sep 18, 2008, at 12:50 PM, William Hatch wrote:
Just migrated a project to mysql, and now all methods that used
the ERXEOControlUtilities.objectWithPrimaryKey() method no longer
work and throw the following exception:
Sep 18 15:21:38 Analytics[55555] (ERXNSLogLog4jBridge.java:41)
WARN NSLog - <com.codefab.analytics.DirectAction>: Exception in
performActionNamed() on the action "pkFetchWithMySQLProblem" with
the message: com.webobjects.jdbcadaptor.JDBCAdaptorException: The
attribute id should be assigned a Number, but the value was the
String "1000002"
java.lang.reflect.InvocationTargetException
[2008-09-18 15:21:38 EDT] <WorkerThread5>
com.webobjects.jdbcadaptor.JDBCAdaptorException: The attribute id
should be assigned a Number, but the value was the String "1000002"
at
com
.webobjects.jdbcadaptor.JDBCColumn.takeInputValue(JDBCColumn.java:
557)
at
com
.webobjects
.jdbcadaptor
.JDBCChannel
._bindInputVariablesWithBindingsAndExecute(JDBCChannel.java:226)
at
com
.webobjects
.jdbcadaptor.JDBCChannel._evaluateExpression(JDBCChannel.java:303)
at
com
.webobjects
.jdbcadaptor.JDBCChannel.evaluateExpression(JDBCChannel.java:261)
at
com
.webobjects
.jdbcadaptor.JDBCChannel.selectAttributes(JDBCChannel.java:185)
This was working in FB no problem. I was initially passing the
string representing the decoded id from the request as the
argument to the method. But, I've tried all the
EOUtilitiesMethods, converting the pk string into a GID or
converting it into an Integer, but I always get this value
massaged into a string. Here's the current call:
EOUtilities.objectWithPrimaryKeyValue(ec, entityName, new
Integer(pkValue)); where pkValue is a string, ec and entityName
are pretty obvious hopefully;-)
What am I doing wrong? Could this be a bug?
The FB plugin does auto conversion of some types. This basically
allows you to pass invalid values to these methods and FB covers up
your sins. Other plugings are more strict in terms of what they
will let you away with.
Chuck
Thanks Chuck. But why would it convert from an Integer back into a
string? I can understand that mysql won't do the nice thing and
convert from the string into the Integer for you, but I'd expect
that if I pass it an integer it would do the right thing.
Are you certain that it is that code causing that exception and not
some other similar code elsewhere that is still passing a string?
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden