-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: one-to-one problem
PostPosted: Wed May 26, 2004 2:42 pm 
Newbie

Joined: Thu Jan 22, 2004 9:17 am
Posts: 3
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.