Hibernate version: 2.1.6
Mapping documents:
Code:
<hibernate-mapping>
<class
name="br.com.rangonline.model.caracteristica.TipoJava"
table="TB_TIPO_JAVA"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="ID_TIPO_JAVA"
type="java.lang.Integer"
unsaved-value="none"
>
<generator class="native">
</generator>
</id>
<property
name="fullClassName"
type="java.lang.String"
update="true"
insert="true"
column="NOM_TIPO_JAVA"
not-null="true"
/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():The create method:
Code:
public void save(TipoJava tipoJava) throws SaveException, ValidationException {
try {
this.session.saveOrUpdate(tipoJava);
} catch (Throwable e) {
HibernateDaoExceptionHelper.salvar(TipoJava.class, e);
}
}
The list all method:
Code:
public List buscarTodos() throws NotFoundException {
try {
List tiposJava = this.session.find("select t from TipoJava as t order by upper(t.fullClassName)");
if (tiposJava.size() == 0) {
return null;
}
return tiposJava;
} catch (Throwable e) {
return (List) HibernateDaoExceptionHelper.buscar(null, e);
}
}
Name and version of the database you are using: MySQL
When i first run the create method, followed by the list all method, it works
fine, persisting the object in the database and listing all the others...but
when i turn to run the list all method again, it reutrn null, and i've already
debug it, and i have a session initialized....i don't understand.
Thanks.
Alexandre.