I receive an error (ORA-01008: not all variables bound) from DB when I try to execute the method getTabelaB().
private static List getTabelaB() { try { Session session = getSession();
Criteria crit = session.createCriteria(TabelaB.class); crit.add(Expression.in("tabelaA", getTabelaA(new Long(1))));
return crit.list();
} catch (HibernateException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } return null; }
private static List getTabelaA(Long cod) { try { Session session = getSession();
Criteria crit = session.createCriteria(TabelaA.class); crit.add(Expression.eq("cod", cod)); return crit.list();
} catch (HibernateException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } return null; }
create table crm.table_a ( cod number(10) PRIMARY KEY, nome varchar2(100) );
create table prohost.table_b ( cod number(10) PRIMARY KEY, nome varchar2(100) );
alter table prohost.tabela_b add (constraint my_constraint foreign key(cod) references crm.tabela_a(cod))
public class TabelaA { private Long cod; private String nome; private iquest.model.entitybean.TabelaB tabelaB; }
public class TabelaB implements Serializable { private Long cod; private String nome; private iquest.model.entitybean.TabelaA tabelaA; }
<class name="iquest.model.entitybean.TabelaA" table="TABELA_A" schema="CRM"> <id name="cod" type="java.lang.Long" column="COD"> <generator class="assigned" /> </id> <property name="nome" type="java.lang.String" column="NOME" length="100"/> <one-to-one name="tabelaB" class="iquest.model.entitybean.TabelaB" outer-join="auto"/> </class>
<class name="iquest.model.entitybean.TabelaB" table="TABELA_B" schema="PROHOST" > <id name="cod" type="java.lang.Long" column="COD"> <generator class="assigned" /> </id> <property name="nome" type="java.lang.String" column="NOME" length="100"/> <one-to-one name="tabelaA" class="iquest.model.entitybean.TabelaA" outer-join="auto" constrained="true"/> </class>
Can anybody help me ?
Thanks
Rogerio
|