You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Dominik Stadler (JIRA)" <ji...@apache.org> on 2010/12/06 20:07:10 UTC

[jira] Created: (OPENJPA-1903) Some queries only work the first time they are executed

Some queries only work the first time they are executed
-------------------------------------------------------

                 Key: OPENJPA-1903
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1903
             Project: OpenJPA
          Issue Type: Bug
          Components: query
    Affects Versions: 2.0.1
            Reporter: Dominik Stadler


I have a problem in my application where a query that sometimes returns data and sometimes not.

I have reduced it to the code as much as I could into an Eclipse project available at http://ubuntuone.com/p/S9n/

This happens with OpenJPA 2.0.1 as well as the daily snapshot from 2010-12-05 and an out-of-process Derby database.

Basically I have two Entities which both use multiple Ids to produce the Primary Key, "Preis" contains a foreign key on "Website":

@Entity
@IdClass(MandantAndNameIdentity.class)
public class Website {
    @Id
    private String mandant;
   
    @Id
    private String name;
...
}

@Entity
@IdClass(WebsiteProduktDatumIdentity.class)
public class Preis {
    @Id
    @ManyToOne(cascade = CascadeType.MERGE)
    private Website website;

    @Id
    @Basic
    private String datum;
...
}

I use the following to set up a website and a Preis:

        em.getTransaction().begin();

        Website website = em.merge(new Website("Mandant", "Website"));

        em.merge(new Preis(website, DATUM));
       
        em.getTransaction().commit();

Afterwards, if I run the query as follows:

       TypedQuery<Preis> q = em.createQuery(
                "select m from Preis m " +
                "where m.website.name = :website ", Preis.class);
       q.setParameter("website", website.getName());

this query works all the time, note that it uses website.name for matching, not the full Website-object.

However if I put the query as

        TypedQuery<Preis> q = em.createQuery(
                "select m from Preis m " +
                "where m.website = :website ", Preis.class);
        q.setParameter("website", website);

it only works ONCE and then does not return any results any more!! See testcase DataAccessVerifyTest for details.

Discussion on the mailinglist seems to indicate that this is a bug. 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (OPENJPA-1903) Some queries only work the first time they are executed

Posted by "Dominik Stadler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12969900#action_12969900 ] 

Dominik Stadler edited comment on OPENJPA-1903 at 12/9/10 2:49 PM:
-------------------------------------------------------------------

I tried todays snapshot build labeled openjpa-2.2.0-20101209.084750-4.jar but my standalone testcase still fails with the same error. 

I also tried to check out the source and add a testcase to the exsiting TestQueryCache testcase. Strangely there it works, although I use the same settings in the Entities and the same test-code! What could be the difference here? I see the following warning when running TestQueryCache, which might be related but which I cannot make much sense of: 

"Query "select m from Child m where m.parent = :parent " is removed from cache  excluded permanently. Query "select m from Child m where m.parent = :parent " is not cached because its result is not obtained by executing a select statement. This can happen if the query was evaluated in-memory. The result was provided by org.apache.openjpa.datacache.QueryCacheStoreQuery$CachingResultObjectProvider.  ."

      was (Author: centic):
    I tried todays snapshot build labeled openjpa-2.2.0-20101209.084750-4.jar but my standalone testcase still fails with the same error. 

I also tried to check out the source and add a testcase to the exsiting TestQueryCache testcase. Strangely there it works, although I use the same settings in the Entities and the same test-code! What could be the difference here? I see the following warning when running TestQueryCache, which might be related but which I cannot make much sense of: 

{code]
Query "select m from Child m where m.parent = :parent " is removed from cache  excluded permanently. Query "select m from Child m where m.parent = :parent " is not cached because its result is not obtained by executing a select statement. This can happen if the query was evaluated in-memory. The result was provided by org.apache.openjpa.datacache.QueryCacheStoreQuery$CachingResultObjectProvider.  .
{code}
  
> Some queries only work the first time they are executed
> -------------------------------------------------------
>
>                 Key: OPENJPA-1903
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1903
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0.1
>            Reporter: Dominik Stadler
>            Assignee: Pinaki Poddar
>
> I have a problem in my application where a query that sometimes returns data and sometimes not.
> I have reduced it to the code as much as I could into an Eclipse project available at http://ubuntuone.com/p/S9n/
> This happens with OpenJPA 2.0.1 as well as the daily snapshot from 2010-12-05 and an out-of-process Derby database.
> Basically I have two Entities which both use multiple Ids to produce the Primary Key, "Preis" contains a foreign key on "Website":
> @Entity
> @IdClass(MandantAndNameIdentity.class)
> public class Website {
>     @Id
>     private String mandant;
>    
>     @Id
>     private String name;
> ...
> }
> @Entity
> @IdClass(WebsiteProduktDatumIdentity.class)
> public class Preis {
>     @Id
>     @ManyToOne(cascade = CascadeType.MERGE)
>     private Website website;
>     @Id
>     @Basic
>     private String datum;
> ...
> }
> I use the following to set up a website and a Preis:
>         em.getTransaction().begin();
>         Website website = em.merge(new Website("Mandant", "Website"));
>         em.merge(new Preis(website, DATUM));
>        
>         em.getTransaction().commit();
> Afterwards, if I run the query as follows:
>        TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website.name = :website ", Preis.class);
>        q.setParameter("website", website.getName());
> this query works all the time, note that it uses website.name for matching, not the full Website-object.
> However if I put the query as
>         TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website = :website ", Preis.class);
>         q.setParameter("website", website);
> it only works ONCE and then does not return any results any more!! See testcase DataAccessVerifyTest for details.
> Discussion on the mailinglist seems to indicate that this is a bug. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (OPENJPA-1903) Some queries only work the first time they are executed

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar reassigned OPENJPA-1903:
--------------------------------------

    Assignee: Pinaki Poddar

> Some queries only work the first time they are executed
> -------------------------------------------------------
>
>                 Key: OPENJPA-1903
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1903
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0.1
>            Reporter: Dominik Stadler
>            Assignee: Pinaki Poddar
>
> I have a problem in my application where a query that sometimes returns data and sometimes not.
> I have reduced it to the code as much as I could into an Eclipse project available at http://ubuntuone.com/p/S9n/
> This happens with OpenJPA 2.0.1 as well as the daily snapshot from 2010-12-05 and an out-of-process Derby database.
> Basically I have two Entities which both use multiple Ids to produce the Primary Key, "Preis" contains a foreign key on "Website":
> @Entity
> @IdClass(MandantAndNameIdentity.class)
> public class Website {
>     @Id
>     private String mandant;
>    
>     @Id
>     private String name;
> ...
> }
> @Entity
> @IdClass(WebsiteProduktDatumIdentity.class)
> public class Preis {
>     @Id
>     @ManyToOne(cascade = CascadeType.MERGE)
>     private Website website;
>     @Id
>     @Basic
>     private String datum;
> ...
> }
> I use the following to set up a website and a Preis:
>         em.getTransaction().begin();
>         Website website = em.merge(new Website("Mandant", "Website"));
>         em.merge(new Preis(website, DATUM));
>        
>         em.getTransaction().commit();
> Afterwards, if I run the query as follows:
>        TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website.name = :website ", Preis.class);
>        q.setParameter("website", website.getName());
> this query works all the time, note that it uses website.name for matching, not the full Website-object.
> However if I put the query as
>         TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website = :website ", Preis.class);
>         q.setParameter("website", website);
> it only works ONCE and then does not return any results any more!! See testcase DataAccessVerifyTest for details.
> Discussion on the mailinglist seems to indicate that this is a bug. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Updated] (OPENJPA-1903) Some queries only work the first time they are executed

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-1903:
----------------------------------

    Fix Version/s: 2.2.0

> Some queries only work the first time they are executed
> -------------------------------------------------------
>
>                 Key: OPENJPA-1903
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1903
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0.1
>            Reporter: Dominik Stadler
>            Assignee: Pinaki Poddar
>             Fix For: 2.2.0
>
>
> I have a problem in my application where a query that sometimes returns data and sometimes not.
> I have reduced it to the code as much as I could into an Eclipse project available at http://ubuntuone.com/p/S9n/
> This happens with OpenJPA 2.0.1 as well as the daily snapshot from 2010-12-05 and an out-of-process Derby database.
> Basically I have two Entities which both use multiple Ids to produce the Primary Key, "Preis" contains a foreign key on "Website":
> @Entity
> @IdClass(MandantAndNameIdentity.class)
> public class Website {
>     @Id
>     private String mandant;
>    
>     @Id
>     private String name;
> ...
> }
> @Entity
> @IdClass(WebsiteProduktDatumIdentity.class)
> public class Preis {
>     @Id
>     @ManyToOne(cascade = CascadeType.MERGE)
>     private Website website;
>     @Id
>     @Basic
>     private String datum;
> ...
> }
> I use the following to set up a website and a Preis:
>         em.getTransaction().begin();
>         Website website = em.merge(new Website("Mandant", "Website"));
>         em.merge(new Preis(website, DATUM));
>        
>         em.getTransaction().commit();
> Afterwards, if I run the query as follows:
>        TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website.name = :website ", Preis.class);
>        q.setParameter("website", website.getName());
> this query works all the time, note that it uses website.name for matching, not the full Website-object.
> However if I put the query as
>         TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website = :website ", Preis.class);
>         q.setParameter("website", website);
> it only works ONCE and then does not return any results any more!! See testcase DataAccessVerifyTest for details.
> Discussion on the mailinglist seems to indicate that this is a bug. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (OPENJPA-1903) Some queries only work the first time they are executed

Posted by "Albert Lee (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Albert Lee resolved OPENJPA-1903.
---------------------------------

    Resolution: Fixed

Confirmed with Pinaki, this issues is completed and can be closed.
                
> Some queries only work the first time they are executed
> -------------------------------------------------------
>
>                 Key: OPENJPA-1903
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1903
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0.1
>            Reporter: Dominik Stadler
>            Assignee: Pinaki Poddar
>             Fix For: 2.2.0
>
>
> I have a problem in my application where a query that sometimes returns data and sometimes not.
> I have reduced it to the code as much as I could into an Eclipse project available at http://ubuntuone.com/p/S9n/
> This happens with OpenJPA 2.0.1 as well as the daily snapshot from 2010-12-05 and an out-of-process Derby database.
> Basically I have two Entities which both use multiple Ids to produce the Primary Key, "Preis" contains a foreign key on "Website":
> @Entity
> @IdClass(MandantAndNameIdentity.class)
> public class Website {
>     @Id
>     private String mandant;
>    
>     @Id
>     private String name;
> ...
> }
> @Entity
> @IdClass(WebsiteProduktDatumIdentity.class)
> public class Preis {
>     @Id
>     @ManyToOne(cascade = CascadeType.MERGE)
>     private Website website;
>     @Id
>     @Basic
>     private String datum;
> ...
> }
> I use the following to set up a website and a Preis:
>         em.getTransaction().begin();
>         Website website = em.merge(new Website("Mandant", "Website"));
>         em.merge(new Preis(website, DATUM));
>        
>         em.getTransaction().commit();
> Afterwards, if I run the query as follows:
>        TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website.name = :website ", Preis.class);
>        q.setParameter("website", website.getName());
> this query works all the time, note that it uses website.name for matching, not the full Website-object.
> However if I put the query as
>         TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website = :website ", Preis.class);
>         q.setParameter("website", website);
> it only works ONCE and then does not return any results any more!! See testcase DataAccessVerifyTest for details.
> Discussion on the mailinglist seems to indicate that this is a bug. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (OPENJPA-1903) Some queries only work the first time they are executed

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12969059#action_12969059 ] 

Pinaki Poddar commented on OPENJPA-1903:
----------------------------------------

If your environment permits, try recent SVN commit r1043221 [1] on trunk.
If it does not, will suggest alternative, non-kosher way to test if the proposed change resolves the reported probiem.
It is a bug.

[1] http://openjpa.208410.n2.nabble.com/svn-commit-r1043221-openjpa-trunk-openjpa-jdbc-src-main-java-org-apache-openjpa-jdbc-kernel-Prepareda-td5813517.html


> Some queries only work the first time they are executed
> -------------------------------------------------------
>
>                 Key: OPENJPA-1903
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1903
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0.1
>            Reporter: Dominik Stadler
>            Assignee: Pinaki Poddar
>
> I have a problem in my application where a query that sometimes returns data and sometimes not.
> I have reduced it to the code as much as I could into an Eclipse project available at http://ubuntuone.com/p/S9n/
> This happens with OpenJPA 2.0.1 as well as the daily snapshot from 2010-12-05 and an out-of-process Derby database.
> Basically I have two Entities which both use multiple Ids to produce the Primary Key, "Preis" contains a foreign key on "Website":
> @Entity
> @IdClass(MandantAndNameIdentity.class)
> public class Website {
>     @Id
>     private String mandant;
>    
>     @Id
>     private String name;
> ...
> }
> @Entity
> @IdClass(WebsiteProduktDatumIdentity.class)
> public class Preis {
>     @Id
>     @ManyToOne(cascade = CascadeType.MERGE)
>     private Website website;
>     @Id
>     @Basic
>     private String datum;
> ...
> }
> I use the following to set up a website and a Preis:
>         em.getTransaction().begin();
>         Website website = em.merge(new Website("Mandant", "Website"));
>         em.merge(new Preis(website, DATUM));
>        
>         em.getTransaction().commit();
> Afterwards, if I run the query as follows:
>        TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website.name = :website ", Preis.class);
>        q.setParameter("website", website.getName());
> this query works all the time, note that it uses website.name for matching, not the full Website-object.
> However if I put the query as
>         TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website = :website ", Preis.class);
>         q.setParameter("website", website);
> it only works ONCE and then does not return any results any more!! See testcase DataAccessVerifyTest for details.
> Discussion on the mailinglist seems to indicate that this is a bug. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1903) Some queries only work the first time they are executed

Posted by "Dominik Stadler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12969900#action_12969900 ] 

Dominik Stadler commented on OPENJPA-1903:
------------------------------------------

I tried todays snapshot build labeled openjpa-2.2.0-20101209.084750-4.jar but my standalone testcase still fails with the same error. 

I also tried to check out the source and add a testcase to the exsiting TestQueryCache testcase. Strangely there it works, although I use the same settings in the Entities and the same test-code! What could be the difference here? I see the following warning when running TestQueryCache, which might be related but which I cannot make much sense of: 

{code]
Query "select m from Child m where m.parent = :parent " is removed from cache  excluded permanently. Query "select m from Child m where m.parent = :parent " is not cached because its result is not obtained by executing a select statement. This can happen if the query was evaluated in-memory. The result was provided by org.apache.openjpa.datacache.QueryCacheStoreQuery$CachingResultObjectProvider.  .
{code}

> Some queries only work the first time they are executed
> -------------------------------------------------------
>
>                 Key: OPENJPA-1903
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1903
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0.1
>            Reporter: Dominik Stadler
>            Assignee: Pinaki Poddar
>
> I have a problem in my application where a query that sometimes returns data and sometimes not.
> I have reduced it to the code as much as I could into an Eclipse project available at http://ubuntuone.com/p/S9n/
> This happens with OpenJPA 2.0.1 as well as the daily snapshot from 2010-12-05 and an out-of-process Derby database.
> Basically I have two Entities which both use multiple Ids to produce the Primary Key, "Preis" contains a foreign key on "Website":
> @Entity
> @IdClass(MandantAndNameIdentity.class)
> public class Website {
>     @Id
>     private String mandant;
>    
>     @Id
>     private String name;
> ...
> }
> @Entity
> @IdClass(WebsiteProduktDatumIdentity.class)
> public class Preis {
>     @Id
>     @ManyToOne(cascade = CascadeType.MERGE)
>     private Website website;
>     @Id
>     @Basic
>     private String datum;
> ...
> }
> I use the following to set up a website and a Preis:
>         em.getTransaction().begin();
>         Website website = em.merge(new Website("Mandant", "Website"));
>         em.merge(new Preis(website, DATUM));
>        
>         em.getTransaction().commit();
> Afterwards, if I run the query as follows:
>        TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website.name = :website ", Preis.class);
>        q.setParameter("website", website.getName());
> this query works all the time, note that it uses website.name for matching, not the full Website-object.
> However if I put the query as
>         TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website = :website ", Preis.class);
>         q.setParameter("website", website);
> it only works ONCE and then does not return any results any more!! See testcase DataAccessVerifyTest for details.
> Discussion on the mailinglist seems to indicate that this is a bug. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1903) Some queries only work the first time they are executed

Posted by "Dominik Stadler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12968428#action_12968428 ] 

Dominik Stadler commented on OPENJPA-1903:
------------------------------------------

setting a query-hint to disable caching makes the query run correctly multiple times:

		q.setHint(QueryHints.HINT_IGNORE_PREPARED_QUERY, queryString); 


> Some queries only work the first time they are executed
> -------------------------------------------------------
>
>                 Key: OPENJPA-1903
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1903
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0.1
>            Reporter: Dominik Stadler
>
> I have a problem in my application where a query that sometimes returns data and sometimes not.
> I have reduced it to the code as much as I could into an Eclipse project available at http://ubuntuone.com/p/S9n/
> This happens with OpenJPA 2.0.1 as well as the daily snapshot from 2010-12-05 and an out-of-process Derby database.
> Basically I have two Entities which both use multiple Ids to produce the Primary Key, "Preis" contains a foreign key on "Website":
> @Entity
> @IdClass(MandantAndNameIdentity.class)
> public class Website {
>     @Id
>     private String mandant;
>    
>     @Id
>     private String name;
> ...
> }
> @Entity
> @IdClass(WebsiteProduktDatumIdentity.class)
> public class Preis {
>     @Id
>     @ManyToOne(cascade = CascadeType.MERGE)
>     private Website website;
>     @Id
>     @Basic
>     private String datum;
> ...
> }
> I use the following to set up a website and a Preis:
>         em.getTransaction().begin();
>         Website website = em.merge(new Website("Mandant", "Website"));
>         em.merge(new Preis(website, DATUM));
>        
>         em.getTransaction().commit();
> Afterwards, if I run the query as follows:
>        TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website.name = :website ", Preis.class);
>        q.setParameter("website", website.getName());
> this query works all the time, note that it uses website.name for matching, not the full Website-object.
> However if I put the query as
>         TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website = :website ", Preis.class);
>         q.setParameter("website", website);
> it only works ONCE and then does not return any results any more!! See testcase DataAccessVerifyTest for details.
> Discussion on the mailinglist seems to indicate that this is a bug. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Closed] (OPENJPA-1903) Some queries only work the first time they are executed

Posted by "Albert Lee (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Albert Lee closed OPENJPA-1903.
-------------------------------

    
> Some queries only work the first time they are executed
> -------------------------------------------------------
>
>                 Key: OPENJPA-1903
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1903
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0.1
>            Reporter: Dominik Stadler
>            Assignee: Pinaki Poddar
>             Fix For: 2.2.0
>
>
> I have a problem in my application where a query that sometimes returns data and sometimes not.
> I have reduced it to the code as much as I could into an Eclipse project available at http://ubuntuone.com/p/S9n/
> This happens with OpenJPA 2.0.1 as well as the daily snapshot from 2010-12-05 and an out-of-process Derby database.
> Basically I have two Entities which both use multiple Ids to produce the Primary Key, "Preis" contains a foreign key on "Website":
> @Entity
> @IdClass(MandantAndNameIdentity.class)
> public class Website {
>     @Id
>     private String mandant;
>    
>     @Id
>     private String name;
> ...
> }
> @Entity
> @IdClass(WebsiteProduktDatumIdentity.class)
> public class Preis {
>     @Id
>     @ManyToOne(cascade = CascadeType.MERGE)
>     private Website website;
>     @Id
>     @Basic
>     private String datum;
> ...
> }
> I use the following to set up a website and a Preis:
>         em.getTransaction().begin();
>         Website website = em.merge(new Website("Mandant", "Website"));
>         em.merge(new Preis(website, DATUM));
>        
>         em.getTransaction().commit();
> Afterwards, if I run the query as follows:
>        TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website.name = :website ", Preis.class);
>        q.setParameter("website", website.getName());
> this query works all the time, note that it uses website.name for matching, not the full Website-object.
> However if I put the query as
>         TypedQuery<Preis> q = em.createQuery(
>                 "select m from Preis m " +
>                 "where m.website = :website ", Preis.class);
>         q.setParameter("website", website);
> it only works ONCE and then does not return any results any more!! See testcase DataAccessVerifyTest for details.
> Discussion on the mailinglist seems to indicate that this is a bug. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira