tags:

views:

24

answers:

0

Problem with OpenJPA. It returns null values on primary key. I debug the open jpa code and i can't find the reason why it returns null on the primary key. I start debugging and the openjpa finds the entry with all data an a value at the primary key but at some point in the code it changes the object and the primary key is gone

This is my query

for (Object o : em.createQuery("select x from AnnouncementsEntry x")
                .getResultList()) {
            //alway returns null in every row
                long id = ((AnnouncementsEntry) o).getEntryId();

This is my definition

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private Long entryId;

This is my percistence.xml

<persistence-unit name="ANO" transaction-type="RESOURCE_LOCAL">

  <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
  <!--
   <jta-data-source>java:comp/env/jdbc/LiferayPool</jta-data-source>
  -->


  <class>de.bgra.ano.db.AnnouncementsDelivery</class>
  <class>de.bgr.ano.db.AnnouncementsEntry</class>
  <class>de.bgr.ano.db.AnnouncementsFlag</class>

  <properties>
   <property name="openjpa.Log"
    value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE" />

   <property name="javax.persistence.jdbc.url"
    value="jdbc:sqlserver://******;databaseName=iportal;SelectMethod=cursor" />
   <property name="javax.persistence.jdbc.password" value="*****" />
   <property name="javax.persistence.jdbc.driver"
    value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
   <property name="javax.persistence.jdbc.user" value="*****" />
  </properties>



 </persistence-unit>

I can't find a solution on this. :( PLEASE HELP! Thanks!