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 Error

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 a

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 l

Re: How to specify LRS in orm.xml?

2009-11-24 Thread Christopher Giblin
nately, not supported in XML > descriptor. Because, JPA spec does not define a XML schema with a simple > 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. > &

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

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 org.apache.openjpa.lib.rop.AbstractResultList

Re: influence connection usage?

2009-09-30 Thread Christopher Giblin
x27;. > > Regards > -mike > > On Tue, Sep 29, 2009 at 8:08 AM, Christopher Giblin wrote: > > > > > Hi, > > Is there any way to influence OpenJPA's connection usage when not using > > connection pooling? > > > > I plan to move to connection p

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 tri

influence connection usage?

2009-09-29 Thread Christopher Giblin
Hi, Is there any way to influence OpenJPA's connection usage when not using connection pooling? I plan to move to connection pooling in the future but cannot quite at the moment. My OpenJPA is configured to use Derby ClientDataSource. When iterating over objects with lazy-loaded attributes, the q

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.

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: Sorry if

Re: metadata api?

2009-09-13 Thread Christopher Giblin
> ClassMapping clsMapping = > > (ClassMapping)JPAFacadeHelper.getMetaData(em, SomeEntity.class); > > > > ForeignKey[] fks = clsMapping.getTable().getForeignKeys(); > > PrimaryKey pk = clsMapping.getTable().getPrimaryKey(); > > > > hth,

Re: metadata api?

2009-09-13 Thread Christopher Giblin
ForeignKey[] fks = clsMapping.getTable().getForeignKeys(); > PrimaryKey pk = clsMapping.getTable().getPrimaryKey(); > > hth, > -Jeremy > > On Wed, Sep 9, 2009 at 3:31 AM, Christopher Giblin wrote: > > > > > Hi, > > I defined object-relational mappings in orm.

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

openjpa, derby, pooled connections?

2009-08-17 Thread Christopher Giblin
Hi, I am developing an Eclipse RCP app with OpenJPA. That is, Java SE, not Java EE. I would like to enable connection pooling and have questions regarding Derby and DB2: 1) Has anyone a OpenJPA config example for DB2 and connection pooling? 2) Is the only way to enable JDBC connection pooling fo

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 Derby

Re: newbie: null Entity Manager Factory in Eclipse

2009-07-20 Thread Christopher Giblin
classpath for your RCP application. > Hopefully this helps! > > -Rick > > On Mon, Jul 20, 2009 at 8:50 AM, Christopher Giblin wrote: > > > > > Hi, > > When I run my test as a standalone Java program, things work. > > When I launch the same code from within a p

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 null