> 
> Instead you could also use
> 
> var perfil = hs.createQuery("mypackage.MyClass as
> myClass where id = " + 
> id).uniqueResult();
> 
> Note that in Java you would normally do something
> like
> 
> MyClass myClass = (MyClass)
> hs.createQuery("mypackage.MyClass as myClass 
> where id = " + id).uniqueResult();
> 
> This is required since createQuery returns an Object
> and not a MyClass. 
> This could mean that you would need another class
> that in turn would 
> query the database.
> 

I used this and it works, but i think to access the
first item in the list is not very elegant ...

var perfil = getById("mypackage.MyClass", id);

function getById(c, id){
  return hs.find("from " + c + " where id = " +
id).get(0);
}


                
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to