3 Replies Latest reply on Dec 8, 2006 8:56 AM by Pete Muir

    PostgreSQL collection problem

    Gregory Nikle Apprentice

      Hi all,
      Sorry for off topic, but those forum is most often searched:P

      My problem is with PostgreSQL db, previous I've used MySQL and everythink worked fine, but when I migrated to Postgre somethink wrong is going on with my collection.

      Let's see.
      Mother has childrens relation 1->n
      List myChildrens = new LinkedList();

      when i load mother object from db i have childrens positioned like I inserted them to db. (that is in mysql).
      example:
      Tom, Mike, Ann.

      After migration to postgresql, every time childrens are loaded different like in set collection.

      Example:
      1. Tom, Mike, Ann
      2. Mike, Ann, Tom etc.

      Anyone have an idea what should i check or what mechanism is responsible for loading objects from db?

      By the way mother object is loaded by Find method NOT query. (order by)
      Or maybe i made somethink wrong in my ds xml file with connection properties.

      Here's and some source code.
      MySQL DS:

      <datasources>
       <local-tx-datasource>
       <jndi-name>MyDS</jndi-name>
      
      <connection-url>jdbc:mysql://localhost:3306/myDB?useUnicode=true&amp;characterEncoding=latin2</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>root</user-name>
       <password>root</password>
       <exception-sorter-class-name>
       org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
       </exception-sorter-class-name>
      
       <metadata>
       <type-mapping>mySQL</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>
      


      and PostgreSQL ds:
      <datasources>
       <local-tx-datasource>
       <jndi-name>MyDS</jndi-name>
      
      <connection-url>jdbc:postgresql://localhost:5432/myDB</connection-url>
       <driver-class>org.postgresql.Driver</driver-class>
       <user-name>postgres</user-name>
       <password>root</password>
      
       <metadata>
       <type-mapping>PostgreSQL 8.2</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>