Hi people,
I have a problem with Hibernate when use Query by Example and the object have a composite-id. When i call the criteria.list() the list return all objects of table. The hibernate dont add composite-id in where clause.
Class: public class ProdutoComposite implements Serializable{ private String idProduto; private String idEmpresa; private String descricao; private double valorUnitario;
/* Here i implements hashCode equals and acessors methods
*/
}
Hibernate version: 3.0.5
Mapping documents: <hibernate-mapping> <class name="com.csi.prototipo.produtocompositeid.ProdutoComposite" table="rodrigo_composite_id"> <composite-id> <key-property name="idProduto" column="ID_PRODUTO"/> <key-property name="idEmpresa" column="ID_EMPRESA"/> </composite-id> <property name="descricao" type="string" column="descricao"/> <property name="valorUnitario" type="double" column="valor_unitario"/> </class> </hibernate-mapping>
Full stack trace of any exception that occurs: None
Name and version of the database you are using: Oracle 9i and Driver ojdbc14.jar
The generated SQL (show_sql=true): Hibernate: select this.ID_PRODUTO as ID_PRODUTO0_, this.ID_EMPRESA as ID_EMPRESA0_, this.descricao as descricao0_, this.valor_unitario as valor_un4_0_ from rodrigo_composite_id this where (1=1)
_________________ Rodrigo Oliveira
|