Although its a simple query for some reason it does not work. Might be something Ive missed.
Hibernate version:
3.0.2
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="gr.forthnet.enosis.oli.pojos.OLIPort"
table="ports"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
>
<id
name="id"
column="id"
type="java.lang.Long"
>
<generator class="increment">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-OLICompany.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<property
name="code"
type="java.lang.String"
update="true"
insert="true"
column="code"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-OLIPort.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
session.load(OLIPort.class, new Integer(1));
Name and version of the database you are using:PostgreSQL 7.4.1
The generated SQL (show_sql=true):Code:
DEBUG [main] (AbstractBatcher.java:311) - select oliport0_.id as id0_, oliport0_.code as code2_0_ from ports oliport0_ where oliport0_.id=?
Hibernate: select oliport0_.id as id0_, oliport0_.code as code2_0_ from ports oliport0_ where oliport0_.id=?
Debug level Hibernate log excerpt:Code:
DEBUG [main] (SessionImpl.java:237) - opened session at timestamp: 4569617595674624
DEBUG [main] (DefaultLoadEventListener.java:185) - loading entity: [gr.forthnet.enosis.oli.pojos.OLIPort#1]
DEBUG [main] (DefaultLoadEventListener.java:258) - creating new proxy for entity
DEBUG [main] (SessionImpl.java:589) - initializing proxy: [gr.forthnet.enosis.oli.pojos.OLIPort#1]
DEBUG [main] (DefaultLoadEventListener.java:331) - attempting to resolve: [gr.forthnet.enosis.oli.pojos.OLIPort#1]
DEBUG [main] (DefaultLoadEventListener.java:367) - object not resolved in any cache: [gr.forthnet.enosis.oli.pojos.OLIPort#1]
DEBUG [main] (BasicEntityPersister.java:2457) - Materializing entity: [gr.forthnet.enosis.oli.pojos.OLIPort#1]
DEBUG [main] (Loader.java:1302) - loading entity: [gr.forthnet.enosis.oli.pojos.OLIPort#1]
DEBUG [main] (AbstractBatcher.java:277) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG [main] (AbstractBatcher.java:422) - opening JDBC connection
DEBUG [main] (AbstractBatcher.java:311) - select oliport0_.id as id0_, oliport0_.code as code2_0_ from ports oliport0_ where oliport0_.id=?
Hibernate: select oliport0_.id as id0_, oliport0_.code as code2_0_ from ports oliport0_ where oliport0_.id=?
DEBUG [main] (AbstractBatcher.java:365) - preparing statement
DEBUG [main] (NullableType.java:59) - binding '1' to parameter: 1