Select aliases not working in OpenJPA 1.2.1

2010-10-11 Thread Christopher Giblin
Hi, I am using the following OpenJPA version in an Eclipse RCP app: OpenJPA 1.2.1 version id: openjpa-1.2.1-r2180:4612 I receive errors when using aliases in a select statement: Example: select s.name, count(distinct g) as c from Systems s, IN(s.groups) g group by s.name order by c

Re: Cannot close EntityManager

2010-04-09 Thread Christopher Giblin
If an exception occurs in remove(), the transaction is still open when the finally block is performed. Check whether the trans is active and roll it back if so, as in the following: } finally { if (em != null) { if (em.getTransaction().isActive()) { em.getTransaction().rollback();

Re: empty collections

2010-01-15 Thread Christopher Giblin
Hi, Solved. Problem was that both sides of the bi-directional relationship were not being assigned before persisting, just one side : user.getGroups().add(group); The following fixed the problem: user.getGroups().add(group); group.getUsers().add(user); Interesting that by restarting the

empty collections

2010-01-07 Thread Christopher Giblin
Hi, I have a bidirectional many-to-many relationship between two entities. Each entity references a collection of the other entity. I import data, then retrieve entities with a query. However, when I refer to an entity's collection, its size is always 0 (eg, group.getUsers().size () is 0). I

How to specify LRS in orm.xml?

2009-11-24 Thread Christopher Giblin
Hi The OpenJPA describes how to indicate that a field should use OpenJPA's large result set proxies using the @LRS Java annotation. Can I specify LRS using orm.xml instead? Thanks,chris

Re: How to specify LRS in orm.xml?

2009-11-24 Thread Christopher Giblin
, not supported in XML descriptor. Because, JPA spec does not define a XML schema with a simple name,value mechanism for vendor extensions. OpenJPA can merge source code annotations with orm.xml -- so, one has to leave OpenJPA-specific mapping annotations on source code itself. Christopher Giblin

noob: NoSuchElementException when using FetchBatchSize

2009-10-29 Thread Christopher Giblin
Hi, I have OpenJPA 1.2.1, Derby 10.3 and deal with large result sets. When I configure openjpa.FetchBatchSize to any number, 0, 1000, whatever, I get the following exception: java.util.NoSuchElementException: The result list has been closed. at

Re: influence connection usage?

2009-09-30 Thread Christopher Giblin
/latest/docs/manual/ manual.html#openjpa.ConnectionRetainMode [2] http://openjpa.apache.org/builds/latest/docs/manual/ manual.html#ref_guide_dbsetup_retain It sounds like you'd benefit from setting it to 'always' or 'transaction'. Regards -mike On Tue, Sep 29, 2009 at 8:08 AM, Christopher

noob: understanding dynamic fetch modes

2009-09-29 Thread Christopher Giblin
Hi, I have a class, A, with a one-to-many relationship to another class, B. Thus A refers to a collection of B. Normally I want to load the collection lazy and therefore set fetch to LAZY in my orm.xml. In one case, however, I want to load A eagerly. I thought the following would do the trick :

relationship EntityManager and JDBC Connection?

2009-09-27 Thread Christopher Giblin
Hi, Does an EntityManager instance correspond one-to-one to a JDBC connection? When the EM is closed, is the JDBC connection closed? That is, by opening and closing EMs, is one also opening and closing JDBC connections? I am using OpenJPA with Derby. There is no connection pooling: property

Re: relationship EntityManager and JDBC Connection?

2009-09-27 Thread Christopher Giblin
... more to the background of my problem : I create an EM instance and loop, calling persist() on perhaps 2,000 objects in batches of 50. I run netstat -an | grep 1527 and observe thousands of TCP sessions being open and closed. Eventually, there are almost 4,000 TCP sockets in TIME_WAIT state.

Re: metadata api?

2009-09-13 Thread Christopher Giblin
= clsMapping.getTable().getPrimaryKey(); hth, -Jeremy On Wed, Sep 9, 2009 at 3:31 AM, Christopher Giblin c...@zurich.ibm.comwrote: Hi, I defined object-relational mappings in orm.xml. Works fine. Is an API available which allows querying of the orm definition for a given object? I am

Re: metadata api?

2009-09-13 Thread Christopher Giblin
[] fks = clsMapping.getTable().getForeignKeys(); PrimaryKey pk = clsMapping.getTable().getPrimaryKey(); hth, -Jeremy On Wed, Sep 9, 2009 at 3:31 AM, Christopher Giblin c...@zurich.ibm.comwrote: Hi, I defined object-relational mappings in orm.xml. Works fine

metadata api?

2009-09-09 Thread Christopher Giblin
Hi, I defined object-relational mappings in orm.xml. Works fine. Is an API available which allows querying of the orm definition for a given object? I am programming with reflection and would like to know, given an object, which of its attributes are primary or foreign keys. Thanks, chris

Newbie: sharing embedded Derby connection

2009-07-21 Thread Christopher Giblin
Hi, I have just completed the first steps with OpenJPA running in my Eclipse RCP app. I use Derby with the EmbeddedDriver. So far so good. I have another set of plugins, Eclipse Data Tools Project (DTP), which provide some DB management tools. However, both OpenJPA and DTP want to own the

newbie: null Entity Manager Factory in Eclipse

2009-07-20 Thread Christopher Giblin
Hi, When I run my test as a standalone Java program, things work. When I launch the same code from within a plugin in an Eclipse RCP app, Persistence.createEntityManagerFactory returns null. I have called Persistence.createEntityManagerFactory both ways, with and without persistence.xml. Get

Re: newbie: null Entity Manager Factory in Eclipse

2009-07-20 Thread Christopher Giblin
On Mon, Jul 20, 2009 at 8:50 AM, Christopher Giblin c...@zurich.ibm.comwrote: Hi, When I run my test as a standalone Java program, things work. When I launch the same code from within a plugin in an Eclipse RCP app, Persistence.createEntityManagerFactory returns null. I have called