Hello.

I'm working with Pervasive Database and i'm trying to successfully make reverse engineering from database to java classes.
When reverse engineering is done, i have ready objects.
But.
In database (table called "Kh") i have column called "datawpr" and it has type "date".
After reverse field "datawpr" in my class has type Serializable.

When i try to get all records from database using hibernate, i get error listed below.

Code:
Exception in thread "main" org.hibernate.type.SerializationException: could not deserialize
   at org.hibernate.util.SerializationHelper.doDeserialize(SerializationHelper.java:262)
   at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:306)
   at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:130)
   at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:116)
   at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:39)
   at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:62)
   at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
   at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:254)
   at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:250)
   at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:230)
   at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:331)
   at org.hibernate.type.ComponentType.hydrate(ComponentType.java:593)
   at org.hibernate.loader.Loader.extractKeysFromResultSet(Loader.java:668)
   at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:606)
   at org.hibernate.loader.Loader.doQuery(Loader.java:829)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
   at org.hibernate.loader.Loader.doList(Loader.java:2542)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
   at org.hibernate.loader.Loader.list(Loader.java:2271)
   at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
   at pl.lanox.test.Test.main(Test.java:19)
Caused by: java.io.StreamCorruptedException: invalid stream header: 32303036
   at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:782)
   at java.io.ObjectInputStream.<init>(ObjectInputStream.java:279)
   at org.hibernate.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:328)
   at org.hibernate.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:318)
   at org.hibernate.util.SerializationHelper.doDeserialize(SerializationHelper.java:237)
   ... 22 more

my hibernate.cfg.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
   <session-factory>
   
      <property name="hibernate.connection.driver_class">com.pervasive.jdbc.v2.Driver</property>
      <property name="hibernate.connection.password">pass</property>
      <property name="hibernate.connection.url">jdbc:pervasive://10.10.10.4/NOWY3</property>
      <property name="hibernate.connection.username">user</property>
      <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
      
      <property name="current_session_context_class">thread</property>
      <property name="show_sql">true</property>

   </session-factory>
</hibernate-configuration>

and method where i try get all records
Code:
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
      session.beginTransaction();
      
      List<Kh> list = (List<Kh>) session.createCriteria(Kh.class).list();
      
      session.getTransaction().commit();

Strange thing is that if i make Connection to this database via Eclipse, this column has data type "9". All others are fine (int, varchar etc.).

Also tried to add this type to revenge.cfg.xml file
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>
<type-mapping>
   <sql-type jdbc-type="9" hibernate-type='timestamp' not-null="false"></sql-type>
</type-mapping>
</hibernate-reverse-engineering>
Result is same when i hardcoded types.

I've tried to hardcode types Serializable to other like: Objest, Date, String, but then i get a list of null objects.
Changing dialect also don't make difference.

When i'm trying to get access by sql, i'm receiving List<Object>.
But in my case i have to get List<Kh>.

Any ideas wham i'm doing wrong or what i'm not doing ?