RE: Fetch Group questions

2008-08-06 Thread Michael Vorburger
1. Thanks, that works great. 2. OK; understand perfectly what your saying; thanks for detailing. (Now our data architect WILL probably cry that "there are unncessary columns fetched!". In the "upper layer" that is creating the FetchPlan, dynamically, we would actually have the information to know

Testing OpenJPA SQL statements using a JDBCListener

2008-08-06 Thread Michael Vorburger
Hello, FYI, a little blog post about how to "capture" the SQL which OpenJPA executed, to test against it in a JUnit, using a JDBCListener : http://www.vorburger.ch/blog1/2008/08/testing-openjpa-sql-statements-usi ng.html Thought this may be useful to others. Cheers, Michael _

Re: Cascade Delete Issue?

2008-08-06 Thread andiqo
I should have found this... Thank you very much! Pinaki Poddar wrote: > > Hi, > When an element X is removed from a collection C in memory -- it does > not imply that the record for X is deleted from database. >Or for that matter, setting > A.b = null does not imply that record for b

Re: Cascade Delete Issue?

2008-08-06 Thread Pinaki Poddar
Hi, When an element X is removed from a collection C in memory -- it does not imply that the record for X is deleted from database. Or for that matter, setting A.b = null does not imply that record for b is deleted from database. Essentially it aligns well with the fact that Java relat

Re: Cascade Delete Issue?

2008-08-06 Thread Fay Wang
Hi, You might want to add @ElementDependent as shown below: @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parent") @OrderBy(value = "ordr") @ElementDependent private List children = new ArrayList(); so that when you do: em.getTransaction().

Re: How to apply creation timestamp with

2008-08-06 Thread Pinaki Poddar
Hi, With MySQL this is what happens: 1. Definition of a column with default timestamp value @Column(name="ts", columnDefinition="TIMESTAMP DEFAULT CURRENT_TIMESTAMP") private Timestamp ts; 2. OpenJPA issues SQL to create the table: CREATE TABLE AutoInc (id BIGINT NOT NULL, ts TIM

Re: searching in double nested list

2008-08-06 Thread Jeremy Bauer
Marc, If I correctly understand the result you seek, you need to do a three way join across the entities. The JPQL below may be what you need (or close to it). The IN() join syntax may also work, but I haven't tried it. "SELECT z FROM Magazine x JOIN x.articles y JOIN y.paragraph z where y.auth

RE: Queries using specific SQL, e.g. functions, or specific operators - passthrough SQL pieces without full native query

2008-08-06 Thread Landers, Richard
Michael, Your situation sounds similar to one I solved with a database view. Is it possible in your environment to introduce a new view and build a new JPA entity on top of that? If so, add the view and define it with whatever derived columns you need to support your use cases using only stan

RE: Queries using specific SQL, e.g. functions, or specific operators - passthrough SQL pieces without full native query

2008-08-06 Thread Michael Vorburger
By chance I just "stumbled upon" the JDBCFilterListener interface, while looking for something totally different. It's implementations like GetColumn and more interestingly SQLEmbed, that "price < sql(\"(SELECT AVG (PRICE) FROM PRODUCT_TABLE)\")", look pretty interesting, and I think is for wh

searching in double nested list

2008-08-06 Thread Marc Logemann
HI, i know that i can entities in relations like this: SELECT x FROM Magazine x, IN(x.articles) y WHERE y.authorName = 'John Doe' But what if i have this objectmodel: Magazine->Articles->Paragraphs And now i want to query for paragraph.number = 2 ??? Your example works with a one level n

Cascade Delete Issue?

2008-08-06 Thread andiqo
Hello, I have two entities PARENT & CHILD defined below. I try to reset the Parent.children list, or remove the parent entity, but nothing happen in database for my children (I cant get my children anymore from Java code (parent.getChildren()), but they are still present in database even after a

Re: ArrayIndexOutOfBoundsException:0 at org.apache.openjpa.jdbc.sql.DBDictionary.getForeignKeyConstraintSQL(DBDictionary.java:3373)

2008-08-06 Thread Gopalakrishnan U
>Could you post your entity source or test case that reproduces the problem ? >Also post your existing table's DDL that contains the foreign key >definition. Catalina, Here is the test case that reproduces the problem: http://n2.nabble.com/file/n675458/identifying_rel_test.zip identifying_rel