glassfish « Query « JPA Q&A





1. java.lang.NumberFormatException after trying to present values from a query    stackoverflow.com

public List findCatalog() {
    Query query = getEntityManager().createQuery("SELECT pc.productCatalog, p.name, p.product FROM ProductCatalog pc JOIN pc.products p");
    return query.getResultList();
}
Hello, with such query my application compiles ...

2. Can't find Hibernate's SessionFactory in my Glassfish app server    stackoverflow.com

I'm just playing around with implementing Hibernate as persistence provider in Glassfish application server. I already configured JNDI datasource, connection pool etc. My Hibernate config is as follows:

    ...

4. [JPA Help needed] Strange query getting created.    java.net

I have entities created by Netbeans for all the tables in database.Now I am trying to execute a query which will give me some columns picked from Customers table and tasks table.I am trying to just create a normal join between these 2 tables, but I am stuck.I am trying this way:

5. Simple JPA query will not return expected result    java.net

I can not get the results from both conditions in my clause. The is null condition does nothing when i have the other condition in place. I get results if i use either condition by itself, but only the results from the companyID =1 if I put them together. Not sure what I can do to fix this without going to ...

6. Simple JPA query will not return expected result    java.net

I can not get the results from both conditions in my clause. The is null condition does nothing when i have the other condition in place. I get results if i use either condition by itself, but only the results from the companyID =1 if I put them together. Not sure what I can do to fix this without going to ...

7. EJBQL: Toplink vs Hibernate query problems    java.net

I saw that in the spec as well but thought it wouldn't hurt to ask. This means that in EJBQL in those circumstances I am always forced to use an (implicit) join. Now I am concerned that this gives a performance hit on all those queries as the JPA provider may translate them into SQL joins. So I did a test ...

8. JPA: order by sum    java.net

9. JPA Query error....    java.net





10. possible to use a JPA Query to get filtered Entity AND Relationship?    java.net

Tom Mutdosch wrote: > Hi there, > I have a question regarding JPA Query > > I have a DEPARTMENT entity with a one-to-many relationship to an > EMPLOYEE entity. Say I want to get "departments with a department > number of 100 and containing EMPLOYEES with more than 15 years of > service". > > Is it possible to get ...

11. possible to use a JPA Query to get filtered Entity AND Relationship?    java.net

Thanks for looking into the caching. As you mentioned, since the spec does not cover caching behavior, I probably should not depend on this behavior being defined by the persistence provider. So it's best not to rely on caching, and just try to minimize the number of queries that I make. It sounds like Marina's suggestion might be a good way ...

12. looks like incorrect JPA QL -> SQL translation.    java.net

Hi there, I have a JPA QL query: Object[] result = (Object[]) em.createQuery("SELECT " + "COUNT(assents1.id), " + "COUNT(assents2.id), " + "status.id, " + "adviser.id, " + "p.id " + "FROM Proposal p " + "LEFT JOIN p.proposalStatus status " + "LEFT JOIN p.adviser adviser " + "LEFT JOIN p.assents assents1 " + "LEFT JOIN p.assents assents2 " + "WHERE p ...

13. looks like another incorrect JPA QL -> SQL translation    java.net

2007/4/10, Witold Szczerba : > Hi there, > few days ago I reported problem about incorrect (in my opinion) JPA QL > -> SQL translation, today I have found something else: > > em.createQuery("DELETE FROM ProposalAssent p WHERE p.proposal = ?1") > .setParameter(1, proposalRef) > .executeUpdate(); > > And here is the exception thrown after executing: > [...] > Caused by: ...

14. JPA query: null values in the query result    java.net

- Entity - AssociatedEntity - Entity has field associatedEntity - database table contains many Entity records WITHOUT references to AssociatedEntities - when I use the following JPA query: SELECT e.associatedEntity.name, e.description FROM Entity e WHERE e.description LIKE 'foo' nothing is returned (there are Entity descriptions with value foo) - when I use the following JPA query: SELECT e.associatedEntity, e.description FROM Entity ...

16. Two simple entities but JPQL Query doesn't work    java.net

I'm not sure why you are trying to join fetch x.shoppingCardPositions - count(x) will only return data not entities, so the join fetch should not be used. The problem though is you have a spelling difference on the accessor methods from the property shoppingCardPositions where as the getters/setters are getShoppingCartPositions. Because you have annotated the methods, the attibute name used will ...





18. how to create dynamic where clause in ejbql of jpa/toplink essentials    java.net

Or you could name your queries in some composable fashion and simply create all of the permutations necessary. Then you at run time build up the label of the SQL you want, and then fetch it from the resource bundle. That way you're assembling the logical name of the query, rather than the query itself.

20. Client side JPA query    java.net

My application uses an applet on the client side communicating to the server side using servlets. Direct communication between the client and server side DB is not possible (firewall issues). The client serializes a simple query object which is then mapped to a JPA named query on the server side. Results are serialized and sent back to the client. For simple ...

21. Question on JPA @SqlResultSetMapping when using a native query    java.net

From the spec, I cannot tell if I need a SqlResultSetMapping annotation or not. On page 72 of the spec, it says "Scalar result types can be included in the query result by specifying the ColumnResult annotation in the metadata." In the annotation definition, the EntityResult property is optional and the ColumnResult property is optional.

22. JPA And date queries    java.net

23. JPA And date queries    java.net

Kenneth Clark wrote: > Hi All > > > > Dumb question. Is there any reference the date functions available in > the JPA QL? I am trying to select and object based on its month (stored > inside a date object) > > > > ________________ > > Thanks and regards > > > > *Kenneth Clark* > > Solutions ...

24. JPA:- java.sql.SQLException : No database selected Error Code: 1046    java.net

Error log : =========================================================== Log Level SEVERE Logger javax.enterprise.system.container.web Name-Value Pairs _ThreadID=26;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=6e64ac88-71e5-4f64-a343-dcc84fe3de0c; Record Number 193 Message ID StandardWrapperValve[Dispatcher Servlet] Complete Message PWC1406: Servlet.service() for servlet Dispatcher Servlet threw exception Local Exception Stack: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.DatabaseException Internal Exception: java.sql.SQLException: No database selected Error Code: 1046 Call: SELECT ID, COSTCENTRE, DEPARTMENT, VPBALANCE, UDF1, PASSWORD, UDF2, ...

25. JPA - One-To-Many relationship query problem    java.net

I am using glassfish-toplink JPA implementation in a standalone application. I am trying to map one to many relationships in two different ways. I am having problems both ways. The class and table relationship I am trying to map looks like this. Class CA is mapped to the table A below. CA has a one to many relationship mapped to CB, ...

26. How to time limit JPA queries?    java.net

27. jpql Query ignore case    java.net

Johnny Tolliver wrote: > On Wed, 30 Apr 2008, Mitesh Meswani wrote: > > >> How about - select e from Entity e where UPPER(e.attr) = UPPER(parameter) >> >> glassfish@javadesktop.org wrote: >> > > >>> Hello everyone. I just want to know the correct syntax for the jpqlQuery >>> in postgresql to ignore the case of the parameter. >>> > > ...

28. JPA queries and properties    java.net

29. JPA Query finds wrong row?    java.net

Diese E-Mail enthlt persnliche, vertrauliche und vor Weitergabe geschtzte Informationen und ist ausschlielich fr den vorgesehenen o.g. Empfnger (Adressaten) bestimmt. Falls Sie diese E-Mail versehentlich erhalten haben und nicht der vorgesehene Empfnger sind, bitten wir Sie, die E-Mail und deren Anhnge nicht aufzubewahren, nicht zu vervielfltigen, nicht zu nutzen und nicht weiterzugeben. Bitte informieren Sie uns als Absender ber diesen Zustellungsfehler ...

30. Query regarding JPA    java.net

I am using JPA in my project. My question is that if i am having two tables say Manager with column as effective_from and table Employee which is referencing Manager Table with same column as effective_from,( effective_from column is not a foreign key in Employee table ) then is it possible for me that if i write a query with where ...

31. Entities refreshing in JPA 2.0 in GlassFish V3    java.net

On 3/2/2010 4:29 AM, glassfish@javadesktop.org wrote: > I have a relation (in Derby 10.5.3.0 ) like Order --> OrderLine. > > In Order is > > @Basic(fetch= FetchType.EAGER ) > public Collection getOrderLinesCollection() { > if ( orderLinesCollection== null ) > orderLinesCollection= new ArrayList(); > return orderLinesCollection; > } > > The problem is > > a) If new OrderLine is ...

32. Dynamic JPA 2.0 query using Criteria API    java.net

Or takes two predicates or an array of predicates. Assuming you have an array of Predicates: Predicate a = restrictions[0]; for (int i = 1; i < max; ++i){ a = criteriaBuilder.or(a, restrictions[i]); } gives a, which is the same as: Predicate a = criteriaBuilder.or(restrictions); You would then add them to the selection criteria via the where call outside the loop: ...

33. problem with JPA query for date handling    java.net

I have a date field in my entity class like @Column(name = "GIVEN_DATE", nullable = false) @Temporal(TemporalType.DATE) public Date getGivenDate() { return givenDate; } The column is defined in Oracle DB as DATE type. I am writing a JPAQL to retrive records based on a flag like 1. if flag = true, then get records greater than today 2. if flag ...