Re: Performance issues

2009-04-20 Thread David Leangen

Ok, now I see why!

  findAll( Class, Collection )

actually executes one transaction for each PK in the collection!!

Here is an excerpt of the log.


8428  openjpa  TRACE  [$Proxy26:1240220275057:task1] openjpa.jdbc.SQL -
t 27011334, conn 15221176 executing prepstmnt 30712384 SELECT
t0.value, t1.TERMVO_ID, t1.element FROM mesh2_terms t0 LEFT OUTER JOIN
mesh2_terms_variants t1 ON t0.id = t1.TERMVO_ID WHERE t0.id = ?
[params=(String) T360914]
138430  openjpa  TRACE  [$Proxy26:1240220275057:task1] openjpa.jdbc.SQL
- t 27011334, conn 15221176 [2 ms] spent


Is there a way I can get everything done in one batch transaction rather
than hundreds or thousands of transactions?

Thank you!
=David



On Mon, 2009-04-20 at 13:49 +0900, David Leangen wrote:
 Thank you, I'll give that a try.
 
 
 
 On Fri, 2009-04-17 at 07:55 -0700, Paul Copeland wrote:
  That sounds interesting.  You might turn on verbose logging for SQL 
  operations (openjpa.jdbc.SQL) and see what queries are actually being 
  executed. The logging section of the OpenJPA manual explains this.
  
  On 4/17/2009 3:41 AM, David Leangen wrote:
   Hello,
  
   I'm not at all an expert in databases, so I don't know if this is a JPA
   thing or a DB thing.
  
   In any case, I'm using Postgresql. Using the findAll( Class,
   Collection ) method, I am doing a  lookup by PK. Since there is an index
   like so on the table:
  
  table_pkey PRIMARY KEY, btree (id)
  
   I would have expected the lookup to be very fast.
  
   With a collection of about 100 ids, the lookup takes almost 30 seconds,
   which does not seem right to me.
  
  
   Any ideas where I should begin to look?
  
  
   Thanks!
   =David
  
  
  
  
  
 
  
 



Can't query against a MappedSuperclass

2009-04-20 Thread jim weaver

I have the following:

@MappedSuperclass class A { }
@Entity class B extends A { }
@Entity class C extends A { }

and I try to do this type of query: SELECT a FROM A a

I receive error message An error occurred while parsing the query filter
SELECT a FROM A a.  Error message:   The name A is not a recognized
entity or identifier.  Perhaps you meant B, which is a close match.  Known
entity names: [B, C]

A is defined in my persistence.xml and my tables do have the inherited
fields from it so I'm pretty sure jpa is recognizing it.

The OpenJPA doc says that the query is supported.this is from the 1.2.0
doc:

Note
OpenJPA allows you to query on mapped superclasses. A query on a mapped
superclass will return all matching subclass instances.


-- 
View this message in context: 
http://n2.nabble.com/Can%27t-query-against-a-MappedSuperclass-tp2665700p2665700.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Can't query against a MappedSuperclass

2009-04-20 Thread Marc Logemann
In the same documentation the following is stated and this was always  
my definition of querying mappedSC.


Section 1.3

A mapped superclass is a non-entity class that can define persistent  
state and mapping information for entity subclasses. Mapped  
superclasses are usually abstract. Unlike true entities, you cannot  
query a mapped superclass, pass a mapped superclass instance to any  
EntityManager or Query methods, or declare a persistent relation with  
a mapped superclass target. You denote a mapped superclass with the  
MappedSuperclass marker annotation. 


So whats correct here? The Note says the opposite...  Perhaps it  
should be made clearer but i always thought that the note is not true,  
because in my code, i experienced the same as Jim.


So any feedback from the core team appreciated

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 20.04.2009 um 21:38 schrieb jim weaver:



I have the following:

@MappedSuperclass class A { }
@Entity class B extends A { }
@Entity class C extends A { }

and I try to do this type of query: SELECT a FROM A a

I receive error message An error occurred while parsing the query  
filter
SELECT a FROM A a.  Error message:   The name A is not a  
recognized
entity or identifier.  Perhaps you meant B, which is a close match.   
Known

entity names: [B, C]

A is defined in my persistence.xml and my tables do have the inherited
fields from it so I'm pretty sure jpa is recognizing it.

The OpenJPA doc says that the query is supported.this is from  
the 1.2.0

doc:

Note
OpenJPA allows you to query on mapped superclasses. A query on a  
mapped

superclass will return all matching subclass instances.


--
View this message in context: 
http://n2.nabble.com/Can%27t-query-against-a-MappedSuperclass-tp2665700p2665700.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.





Re: OPENJPA_SEQUENCE_TABLE: needed even with IDENTITY columns?

2009-04-20 Thread Pinaki Poddar

1. To verify that OPENJPA_SEQUENCE_TABLE is not getting created by another
entity, can you run the application with a single simple class such as
@Entity
public class PObject {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private long id;

public long getId() {
return id;
}

}

2. What is the resultant schema for PObject on H2 database?


ljnelson wrote:
 
 Hello.  I am using the H2 database for some simple unit tests, with
 OpenJPA sitting on top of it.
 
 I am wondering how to get OpenJPA to stop trying to create or look for the
 OPENJPA_SEQUENCE_TABLE, particularly since nothing in my entity model
 requires it (I explicitly use the @GenerationType of IDENTITY, which I
 took it was supposed to use the native auto-incrementing ability of the
 database, if there is one (which there is in H2).
 
 Could someone tell me either how to instruct OpenJPA to basically insert
 NULL into the primary key column instead of trying to insert a value it
 thinks it can get from the non-existent OPENJPA_SEQUENCE_TABLE?  If I
 wanted to use a table, I would have used @GenerationType.TABLE, not
 @GenerationType.IDENTITY.
 
 Thanks very much!
 
 Best,
 Laird
 


-
Pinaki Poddar  http://ppoddar.blogspot.com/
  
http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member
-- 
View this message in context: 
http://n2.nabble.com/OPENJPA_SEQUENCE_TABLE%3A-needed-even-with-IDENTITY-columns--tp2657337p2666410.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: OPENJPA_SEQUENCE_TABLE: needed even with IDENTITY columns?

2009-04-20 Thread Tedman Leung
I should briefly mention that I had the same problem using the MySql 
database.

I'm sure I'm not using the SEQUENCE table because I manually created my 
database tables and I was just migrating to using the schema generator.

In my case it was tracked down to using an @EmbeddedId in the model class

@EmbeddedId
private FacilityIdIntegerCompositePk facilityDemographicPk;


the @Embeddable class contained 2 Integers with no annotations.

private Integer integratorFacilityId = null;
private Integer caisiItemId = null;

I just ignored it as it wasn't creating any problems for me. My 
application still runs fine and there's not a single row in the sequence 
table.

On Mon, Apr 20, 2009 at 02:18:13PM -0700, Pinaki Poddar wrote:
 
 1. To verify that OPENJPA_SEQUENCE_TABLE is not getting created by another
 entity, can you run the application with a single simple class such as
 @Entity
 public class PObject {
   @Id
   @GeneratedValue(strategy=GenerationType.IDENTITY)
   private long id;
   
   public long getId() {
   return id;
   }
 
 }
 
 2. What is the resultant schema for PObject on H2 database?
 
 
 ljnelson wrote:
  
  Hello.  I am using the H2 database for some simple unit tests, with
  OpenJPA sitting on top of it.
  
  I am wondering how to get OpenJPA to stop trying to create or look for the
  OPENJPA_SEQUENCE_TABLE, particularly since nothing in my entity model
  requires it (I explicitly use the @GenerationType of IDENTITY, which I
  took it was supposed to use the native auto-incrementing ability of the
  database, if there is one (which there is in H2).
  
  Could someone tell me either how to instruct OpenJPA to basically insert
  NULL into the primary key column instead of trying to insert a value it
  thinks it can get from the non-existent OPENJPA_SEQUENCE_TABLE?  If I
  wanted to use a table, I would have used @GenerationType.TABLE, not
  @GenerationType.IDENTITY.
  
  Thanks very much!
  
  Best,
  Laird
  
 
 
 -
 Pinaki Poddar  http://ppoddar.blogspot.com/
   
 http://www.linkedin.com/in/pinakipoddar
 OpenJPA PMC Member/Committer
 JPA Expert Group Member
 -- 
 View this message in context: 
 http://n2.nabble.com/OPENJPA_SEQUENCE_TABLE%3A-needed-even-with-IDENTITY-columns--tp2657337p2666410.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.
 

-- 
   Ted Leung
   ted...@sfu.ca

I am what what the world has taught me to be.


Problems in setting up the work enviroment.

2009-04-20 Thread ashish paliwal
Hello,

I am new GSOC guy and I will be working on the Slice module. I was
trying to set up my development environment and downloaded the 1.2.1
release for the same. I was trying to compile the hellojpa program
given in example folder but it is not able to find javax.persistence
package. Actually there is no persistence package in my standard java
distribution.
Can someone please tell me how to sort out this problem. Also is there
some eclipse plugin to work with OpenJPA.
Being new to this type of work environment, I might be asking lot of
stupid questions at first, so please bear with me.

thanks and regards

-- 
Ashish Paliwal
Mobile : 9305128367
IIT Kanpur
India