You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by JD Daniels <jd...@kismetsoftware.com> on 2005/01/26 18:05:24 UTC

[SOLVED] Re: [flow] Hibernate createCriteria syntax help?

        var criteria = 
hs["createCriteria"](full.package.name.insecticide.Bug);
        
criteria["add"](Packages.net.sf.hibernate.expression.Expression.eq("status", 
"UNCONFIRMED"));
        var bug = criteria.list();

seems to work .. I guess flow doesn't like the .class, but it seems it 
is not needed.

JD


JD Daniels wrote:

> Yeah thats the same problem I'm having I think - except it is the line 
> above it is dying on:
>
> var criteria = hs["createCriteria"](Bug[class]); - Identifier is a 
> reserved word
> var criteria = hs["createCriteria"](Bug.class);  - missing name after 
> . operator
>
> arg
>
>
> Brent Johnson wrote:
>
>> I've run into this error before.  This usually means that some
>> function used is a Javascript builtin function (or statement).  So
>> odds are, either add() or eq() are functions or statements in
>> Javascript.
>>
>> I ran into this problem with a Java method I called delete().  So I'm
>> guessing that your add() call is the problem.  Change the call to
>> something like this and see if it works:
>>
>> criteria["add"](Expression.eq("status", "UNCONFIRMED"));
>>
>> - Brent
>>
>> On Wed, 26 Jan 2005 10:14:12 -0500, JD Daniels 
>> <jd...@kismetsoftware.com> wrote:
>>  
>>
>>> Hi all,
>>>
>>> I am trying to add criteria inside a flowscript. Here is what i think
>>> should work:
>>>
>>> 1        var criteria = hs.createCriteria(Bug.class);
>>> 2       criteria.add(Expression.eq("status", "UNCONFIRMED"));
>>> 3        var bug = criteria.list();
>>>
>>> this spits out : missing name after . operator on line 1
>>>
>>> I have tried variations of switching to the the [""] syntax of calling
>>> methods, but while they fix the error, criteria is always undefined.
>>>
>>> Anyone have insight into how i can call these methods in flow?
>>>
>>> full function:
>>>
>>> function search_bug()
>>> {
>>>        // Create The Form
>>>        var form = new Form("forms/bugSearchModel.xml");
>>>
>>>        // Set Some Form Specific Text Fields
>>>        var model = form.getWidget();
>>>        model.buttonText = "Search";
>>>        model.title = "Search Bug Database";
>>>
>>>        form.showForm("internal/show-form/bugSearch");
>>>
>>>        // Create Hibernate Session
>>>        var factory =
>>> cocoon.getComponent(Packages.com.kismetsoftware.insecticide.PersistenceFactory.ROLE); 
>>>
>>>        var hs = factory.createSession();
>>>
>>>        // Might as well quit now if the session is no good :(
>>>        if (hs == null){throw new
>>> Packages.org.apache.cocoon.ProcessingException("Hibernate session is
>>> null ");}
>>>
>>>        // This is problem Line:
>>>        var criteria = hs.createCriteria(Bug.class);
>>>        criteria.add(Expression.eq("status", "UNCONFIRMED"));
>>>        var bug = criteria.list();
>>>
>>>        // Clean Up Our Mess :)
>>>        hs.flush();
>>>        hs.close();
>>>        cocoon.releaseComponent(factory);
>>>
>>>        // Send The User Their Result
>>>        cocoon.sendPage("internal/generate-view/bug_summary", {title :
>>> "Bugs",bug : bug});
>>> }
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>>   
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
>>  
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org