Is it possible to specify a cascading delete in the code if you didn't
set it in the relationship in the modeler? Or do I need to loop through
the collection and delete each one?
Fredrik
-----Original Message-----
From: Michal Kozlowski [mailto:mkozlowsk..MVProjects.com]
Sent: Friday, April 08, 2005 7:19 AM
To: cayenne-use..bjectstyle.org
Subject: RE: Stored Procedure Date casting problem...
That simple, yikes that obvious solution didn't even occur to me. My
apologies that I didn't search the Jira issues.
Thanks for the help
Mike
-----Original Message-----
From: Andrus Adamchik [mailto:andru..bjectstyle.org]
Sent: Thursday, April 07, 2005 8:57 PM
To: cayenne-use..bjectstyle.org
Subject: Re: Stored Procedure Date casting problem...
Yeah, ProcedureQueries are unfortunately lacking in this respect. I
opened a number of Jira issues to address it (notable this one -
http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-148 ). The
goal is to make them as flexible as SQLTemplate queries.
Regarding your specific case:
> public java.sql.Date getDate() {
> return (java.sql.Date)readProperty("date");
> }
I suggest simply mapping your DataObject "date" property as
java.util.Date. You won't sacrifice any functionality if you do that.
Andrus
On Apr 6, 2005, at 1:54 PM, Michal Kozlowski wrote:
> Hi everyone,
> I'm loving the new SQL Server generatePK feature rith the jTDS driver,
> works awesome.
>
> Now my problem is I create a stored procedure that I want to generate
> a data object from, the stored procedure is in the modeler, and I also
> generated a stored procedure query that would allow me to fetch data
> objects. Now the data object that I'm getting has a sql.Date
> attribute which works if I just do a Select Query using cayenne like
> so...
>
> Expression qualifier = ExpressionFactory.matchDbExp("ProjectId",
> "Z00451");
> qualifier =
> qualifier.andExp(ExpressionFactory.matchDbExp("UserId", "NGO001"));
> qualifier =
> qualifier.andExp(ExpressionFactory.matchDbExp("UnitId", "020"));
>
> SelectQuery query = new SelectQuery(ActualConnected.class,
> qualifier);
> List actuals = getDataContext().performQuery(query);
> return actuals;
>
> When I do the same thing with a stored procedure I get an error from a
> cast that is trying to cast a util.Date to sql.Date which cannot be
> done. Is there any way to prevent this cast from happening
> automatically?
>
> ProcedureQuery query = (ProcedureQuery)
>
getDataContext().getEntityResolver().lookupQuery("getUserActualsQuery")
> ;
> query.addParameter(..rojectID","Z00451");
> query.addParameter(..serID", "NGO001");
> query.addParameter(..nitID", "020");
> return getDataContext().performQuery(query);
>
> The error happens here in the data object that is trying to be read
...
>
> public java.sql.Date getDate() {
> return (java.sql.Date)readProperty("date");
> }
>
> Thanks for any information to get this working, I'm wondering if there
> is any way to prevent the stored procedure result from being cast to a
> util.Date and make it go into a sql.Date object
>
> Cheers
> Mike
>
> Developer/Database Administrator
> IMV Projects Inc.
> (403) 770-7552
>
> It is a painful thing
> To look at your own trouble and know
> That you yourself and no one else has made it
> - Sophocles, Ajax
>
This archive was generated by hypermail 2.0.0 : Fri Apr 08 2005 - 15:00:12 EDT