[nbdev] Need help with some

  • From: "charlesrv" < >
  • To:
  • Subject: [nbdev] Need help with some
  • Date: Sat, 24 Nov 2012 11:26:36 -0500

I want to get a list from one table but i want to send as parameter the 
foreign key. This code it is ok, but:


> public Atencion list(String areaatencion ){
> Atencion a;
> EntityManager em=getEm();
>   try{
>      Query q=em.createQuery("SELECT a FROM Atencion a WHERE a.areaatencion 
> ='"+areaatencion +"'");
>      a=(Atencion)q.getSingleResult();
>      //a=(Atencion[])q.getResultList().toArray(new Atencion[0]);
>   }catch (Exception e){
>      a=null;
>   }
> return a;
> }


Code:
..



I want to send CodHistorial (foreign key) as parameter

> public Atencion list(String CodHistorial){
> Atencion a;
> EntityManager em=getEm();
>   try{
>      Query q=em.createQuery("SELECT a FROM Atencion a WHERE 
> a.codhistorial='"+CodHistorial+"'");
>      a=(Atencion)q.getSingleResult();
>      //a=(Atencion[])q.getResultList().toArray(new Atencion[0]);
>   }catch (Exception e){
>      a=null;
>   }
> return a;
> }


And the problem is that my class Atencion takes codhistorial as object so i 
do not know how modify my query






[nbdev] Need help with some

charlesrv 11/24/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close