Re: EOSQLQualifier error
Re: EOSQLQualifier error
- Subject: Re: EOSQLQualifier error
- From: Gilles MATHURIN <email@hidden>
- Date: Tue, 2 Jan 2007 13:13:35 -0400
Thanks all, just thinking to go back to EOs instead of raw rows, as
raw rows are not vital for what i am doing, so no need for this
complication and thanks for the Lock semantics.
Le 2 janv. 07 à 11:24, Steve Quirk a écrit :
From the javadoc for EOSQLQualifier:
" The class EOSQLQualifier is deprecated. Use
EOAdaptorChannel.evaluateExpression() or
EOFetchSpecification.setHints() instead."
Since you're working in SQL, not objects (EO's), I don't really
have a simple translation for you. (That can be quite frustrating
when using EOF).
Also, your EC lock semantics are incorrect. Instead, always use
something like
... (set up your qualifiers, etc)
try {
ec.lock();
talents = ec.objectsWithFetchSpecification(fetchSpec);
} finally {
ec.unlock();
}
Otherwise, you're going to end up with some really hard to debug
deadlocks.
Good luck,
Steve
On Tue, 2 Jan 2007, Gilles MATHURIN wrote:
Hello All and Happy new year 2007 !!
I have an error when trying to use an EOSQLQualifier statement.
Here is the statement in his method and following the error log
obtained when building
----- Method ------
public void appendToResponse(WOResponse response, WOContext
context) {
if (talents==null) {
EOEditingContext ec = new EOEditingContext();
ec.lock();
EOSortOrdering lastName = EOSortOrdering.sortOrderingWithKey
("lastName", EOSortOrdering.CompareAscending);
EOSortOrdering firstName = EOSortOrdering.sortOrderingWithKey
("firstName", EOSortOrdering.CompareAscending);
NSArray orderings = new NSArray(new Object[] {lastName,
firstName});
EOEntity talentEntity = EOUtilities.entityNamed(ec,"Talent");
EOSQLQualifier sqlQualifier = new EOSQLQualifier(talentEntity,
"TALENT_ID IN (SELECT TALENT_ID FROM MOVIE_ROLE)");
EOQualifier qualifier = sqlQualifier;
if (lastNameQueryString !=null) {
NSArray qualifierBindings = new NSArray (new String[]
{lastNameQueryString+"*"});
qualifier = EOQualifier.qualifierWithQualifierFormat("lastName
like %@", qualifierBindings);
qualifier = new EOAndQualifier(new NSArray(new Object[]
{qualifier, sqlQualifier}));
}
EOFetchSpecification fetchSpec = new EOFetchSpecification
("Talent", qualifier, orderings);
fetchSpec.setFetchesRawRows(true);
talents = ec.objectsWithFetchSpecification(fetchSpec);
}
super.appendToResponse(response,context);
}
----------------------
----- Error Stack ------
TalentListPage.java:43: cannot find symbol
symbol : constructor EOSQLQualifier
(com.webobjects.eoaccess.EOEntity,java.lang.String)
location: class com.webobjects.eoaccess.EOSQLQualifier
EOSQLQualifier sqlQualifier = new EOSQLQualifier( talentEntity,
"TALENT_ID IN (SELECT TALENT_ID FROM MOVIE_ROLE)");
^
Note: TalentListPage.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
---------------------------
Any idea of what is going wrong, i saw it is a depecrated API,
does it mean it is no longer part of the WO frameworks ?
if so, any idea of how can i integrate the none depecrated API
suggested by the docs ? Which are :
EOAdaptorChannel.evaluateExpression() or
EOFetchSpecification.setHints()
Thanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
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