find « Query « JPA Q&A





1. Programmatically find out if system supports standby    stackoverflow.com

This happens sometimes with Windows XP installations. Unless the display drivers are installed, power saving actions such as standby and hibernate are not supported. Whether the system supports hibernate can be checked ...

2. Hibernate: find duplicates    stackoverflow.com

Assume I have the following Groovy class (or the equivalent in Java)

class User  {
    Long id
    String name
}
I would like to write a Hibernate ...

3. JPA find the Last entry    stackoverflow.com

I would like to know what's the best way to get the last entry of a table with JPA. In Sql, what I'm looking for would be like:

 select id from table ...

4. Hibernate HQL query for finding entries older than 3 hours    stackoverflow.com

How should I go about setting up HQL condition that would select all the object who's date property is older than 3 hours from now.

5. How can I find the most recent state change (= the current state) using JPA 2.0 Criteria?    stackoverflow.com

I have this entity:

StateChange{ 
Date date
String state;
} 
How can I find the most recent state change (= the current state) using JPA 2.0 Criteria? I think I would need to sort by ...

6. Hibernate cannot find Embeded JavaDB in NetBeans    forums.netbeans.org

I created an embedded JavaDB by NetBeans. I can find the database by NetBeans and during creating Entity Classes in NetBeans. However, when I created Hibernate POJO, it prompted that the ...

7. Hibernate find()    coderanch.com

8. problem with find() in jpa    coderanch.com

9. find query problem....    forum.hibernate.org





10. How to find duplicates using Hibernate/JPA?    forum.hibernate.org

I am having trouble figuring out how to identify duplicates in a table (where lastName and firstName are equal). I will give the working SQL and my attempted JPA. Working SQL: Code: SELECT DISTINCT c1.* FROM Contact c1 inner join Contact c2 on c1.firstName = ...

11. hql find a user by name takes too lang.    forum.hibernate.org

Newbie Joined: Fri Nov 27, 2009 8:43 am Posts: 1 i have a problem about hql i have a user object , i use hibernate hql, getHibernateTemplate.find(from user where username = 'name', "jack"); to get the object. The user entity has a lot of @OneToMany or @ManyToMany relationships to other objects. It takes about 6 seconds to load the user object ...

12. Find by NaturalIdentifier with many-to-one    forum.hibernate.org

Hello, I have declared a that includes a relation. I'm trying to use it in my Dao but I'm getting an org.springframework.dao.InvalidDataAccessApiUsageException: org.blah.Owner; nested exception is org.hibernate.TransientObjectException: org.blah.Owner My test is: Case case = new Case(new Owner("me"), ...); assertNull(dao.findByNaturalKey(case)); The findByNaturalKey is: NaturalIdentifier naturalId = Restrictions.naturalId(); naturalId.set("owner", case.getOwner()); It works for the other natural keys, how do ...

13. Find all latest    forum.hibernate.org

I have a Hibernate mapped status class that holds multiple status entries for an entity, like... Code: public class EntityStatus { private int OwningEntityID private int StatusID private java.util.Date StatusUpdated } ...

14. Harness Hibernate Ch06 -cannot find symbol :constuctor Track    forum.hibernate.org

can you help with the compiling error in Chap06 code? It is like the code constructor is not compatible with declaration in Track.java Usertypes In chap06 ant codegen ant prepare are OK. ant schema resulted in /examples/ch10/src/com/oreilly/hh/CreateTest.java:73: cannot find symbol [javac] symbol : constructor Track(java.lang.String,java.lang.String,java.sql.Time,java.util.HashSet,java.util.Date,com.oreilly.hh.StereoVolume,com.oreilly.hh.SourceMedia,java.util.HashSet) [javac] location: class com.oreilly.hh.data.Track [javac] track = new Track("Video Killed the Radio Star", The signature of ...

15. Problem with the find method of HibernateTemplate    forum.hibernate.org

Hi, I am having some problem with the Hibernate + Spring testing framework. I have written a test that saves a record in a transaction. When I use the get method of HibernateTemplate, it works fine but when I try to execute the find method. It does not return the object that I saved in the same transaction. Below is my ...

16. QuerySyntaxException, can't find it    forum.hibernate.org

Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxException: unexpected token: on near line 1, column 84 [select b from de.taf.easygo.modules.timetable.hafas.Bahnhof as b join BfKoord as k on b.nummer = k.bahnhof_nummer where (k.x >= 10.993004838908002 and k.x <= 11.006995161091998 and k.y >= 49.9955035971223 and k.y <= 50.0044964028777) order by b.name] Could anybody pls tell me what exactly causes this exception? =( Many thanx!





18. JPA 2.0 Criteria: Find most recent state change    forum.hibernate.org

//Obtain entity manager EntityManager em = ... //Required item ID. int id = ...; CriteriaBuilder builder = em.getCriteriaBuilder(); EntityType type = em.getMetamodel().entity(StateChange.class); //Select the max value of date from the StateChange entity //where the ID matches the required ID and the date is not null (ANSI requirement, prevent aggregating null values). CriteriaQuery query1 = builder.createQuery(Date.class); Root root1 = query1.from(StateChange.class); Expression maxDateExpression ...

19. Best practices for "find or create" operations.    forum.hibernate.org

20. Sincronize problem. Store and find    forum.hibernate.org

Hello, running some tests I have faced some problems. When I try to store one object, which it has fixed id (not auto generated), I can not find it. The process is: Code: public Concept storeIfNotExistsConcept(Concept conceptToTest) throws DataAccessLayerException{ // this.storeConcept(conceptToTest); // return conceptToTest; ...

21. find in multiuser environment    forum.hibernate.org

I'm using hibernate in a multiuser environment. This means, many users are able to update an object on the database at the same time using different (hibernate) sessions. My problem is, that an object o, that was once loaded from the db, is cached and not reloaded from db, until I force this by an explicit session.reload(o). This means, if o ...

22. how to simply find all devices which has no parent ?    forum.hibernate.org

I know it is not best but it works now in my current situation. I do twice query to resolve the sub-query problem as below: private String get_root_device() { StringWriter result = new StringWriter(); Session sess = null; try { Marshaller marshaller = new Marshaller(result); sess = sf.openSession(); Query q = sess.createQuery("select d.devId from com.omnet.test.Device d join d.parent p"); List tmp ...

23. Using a PersistentEnum in find() / a query    forum.hibernate.org

24. Problem with find method    forum.hibernate.org

I have 2 classes Internaute and Login bind by a one-to-one bidirectionnal association. When a user authenticates, i retrieve informations in order to create a Login object. Then i execute the following method : Code: public Internaute rechercherUtilisateur(Login l) { try ...

25. Criteria Find Not Working Correctly    forum.hibernate.org

Author Message keegan Post subject: Criteria Find Not Working Correctly Posted: Tue Jan 13, 2004 11:53 pm Newbie Joined: Wed Dec 31, 2003 9:45 pm Posts: 19 This used to work, and I don't know what changed to create this behavior - HELP! I am converting some legacy code to Hibernate. I created a method called QueryEngine.queryByExample which takes ...

26. DTO or not DTO, together, find THE solution    forum.hibernate.org

hi all, it seems that experts discussing here have the solution for their layered architecture. For us, we use: - struts for the controller and we're planning to use JSF later for the presentation layer - a business (or pseudo service) layer to define our business rules and adapt domain model to views - a Data access layer to code reusable ...

27. Can't find SerialContextProvider    forum.hibernate.org

Newbie Joined: Mon Mar 29, 2004 2:40 pm Posts: 2 Location: Colorado I am learning Hibernate from the: "Java Open Source Programming" book and I have a handle on how Hibernate works but when doing their example, I get an error: Code: Mar 29, 2004 11:41:20 AM net.sf.hibernate.cfg.Environment INFO: Hibernate 2.1.1 Mar 29, 2004 11:41:20 AM net.sf.hibernate.cfg.Environment INFO: hibernate.properties ...

28. Find Query    forum.hibernate.org

Hello, I'm sure there is a very simple answer to this. I am trying to write a query. I have 3 classes. A project, a person and an association between them. The association references the other 2 objects. What I'm trying to do is find all the people for a given project. Can anyone help. Thanks H [b]Hibernate version:[/b] [b]Mapping documents:[/b] ...

29. ArrayIndexOutOfBoundsException on find    forum.hibernate.org

Newbie Joined: Fri Feb 11, 2005 1:41 pm Posts: 3 Location: Indianapolis, IN USA I'm trying to store my RecurringOrderProductVariationDTO in the db, but am getting an ArrayIndexOutOfBoundsException. I've created a test to isolate the problem, but have been unsuccessful figuring out where I've gone astray. The popular cause of this problem seems to be an error in the mapping file, ...

30. C3P0 cant find driver....    forum.hibernate.org

Newbie Joined: Wed Apr 27, 2005 7:12 pm Posts: 2 Hello I am fairly new to hibernate, so excuse me if i am asking stupid.. My problem is that C3P0 dosent seem to get the corect Driver file. The driver .jar is in the classpath, but still i get the folowing from log4j: Quote: 01:09:41,473 INFO Environment:460 - Hibernate 3.0 01:09:41,473 ...

31. Could not find UserTransaction in JNDI...    forum.hibernate.org

Regular Joined: Fri Feb 25, 2005 3:02 am Posts: 71 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp [b]Hibernate version:3.0[/b] [b]Mapping documents: org.hibernate.dialect.PostgreSQLDialect false

32. find() method from hibernate 2 to hibernate 3    forum.hibernate.org

Hibernate 2 had a find method which is now replaced in hibernate 3 with createQuery. It had three such overloaded methods: (1) find(String arg0) - returns list (2) find(String arg0, Object arg1, Type arg2) - returns list (3) find(String arg0, Object[] arg1, Type[] arg2) - returns list I know how to work with (1) find(arg0).list() , but I don't know how ...

33. problem with find query in Hibernate    forum.hibernate.org

Mapping documents: seq_code_id

34. TransactionException: Could not find UserTransaction in JNDI    forum.hibernate.org

Newbie Joined: Fri Aug 05, 2005 10:38 am Posts: 11 Hi, i developed with 4.0.3RC1+RC2 and all works fine. Today i tried to deploy my application to 4.0.3 release and i get an exception. In some way Hibernate TransactionFactory cannot create a Transaction because the Factory doesnt find something via JNDI... My jboss-service.xml looks like this: Code: ...

35. Could not find prepared statement with handle    forum.hibernate.org

Hi, I am using JRUN 4 and Hibernate 3, MS-SQL server 2000. I have one datasource "SP62203Master" configured in my JRun, in which I need to access 2 databases. When I execute some piece of code dealing with the tables involved in different databases, The code gets executed successfully very first time but when I refresh my web page using F-5, ...

37. Could not find a SessionFactory    forum.hibernate.org

Hit to all! We are developing a J2EE application using Sun AS and Hibernate as persistence layer. We are trying to use Hibernate with a Swing user interface but when we try to get the session factory via JNDI we get this exception: Caused by: java.io.InvalidObjectException: Could not find a SessionFactory named: hibernate/SessionFactory at org.hibernate.impl.SessionFactoryImpl.readResolve(SessionFactoryImpl.java:622) ... 25 more This is the ...

38. Cannot Find a Web Host That Supports Hibernate?!    forum.hibernate.org

Hello, I have a Spring/Hibernate application built and it's ready to go. Unfortunately, I have not found a single Java webhost that says Hibernate is ok. They all say that it consumes too much memory/resources. I may have to find a VPS so I can run whatever I want, but the memory included with most VPS packages that I can afford ...

39. Unable to perform find    forum.hibernate.org

com.etil.base.error.ErrorManager 2006-03-07 20:57:48,830 ERROR [http-0.0.0.0-8080-Processor25] - net.sf.hibernate.exception.SQLGrammarException: Could not execute query at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:69) at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:30) at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4110) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1556) at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39) at com.etil.sudetp.business.manager.user.UserManager.inquireProfileCommunity(UserManager.java:371) at com.etil.sudetp.business.manager.user.UserManager.processRequest(UserManager.java:192) at com.etil.sudetp.business.manager.BaseManager.processRequest(BaseManager.java:132) at com.etil.sudetp.presentation.SyncRouter.process(SyncRouter.java:39) at com.etil.sudetp.presentation.http.page.ViewProfileCommunity.loadPage(ViewProfileCommunity.java:88) at com.etil.sudetp.presentation.http.page.ViewProfileCommunity.activateExternalPageImpl(ViewProfileCommunity.java:81) at com.etil.sudetp.presentation.http.page.BidNPlayPage.activateExternalPage(BidNPlayPage.java:41) at org.apache.tapestry.engine.ExternalService.service(ExternalService.java:161) at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:872) at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197) at org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:158) at javax.servlet.http.HttpServlet.service(HttpServlet.java:697) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) ...

40. Could not find configuration [UpdateTimestampsCache];    forum.hibernate.org

I am trying to use EhCacheProvider in hibernate. i have made a simple class where i am storing the data and then getting the list of data. when i execute my project it stores my data but gives me few warnings. I am not sure if my cache is working properly or not. WARN - Could not find configuration [test.Customer]; using ...

41. cannot find ehcacheprovider??    forum.hibernate.org

42. Could not find UserTransaction in JNDI    forum.hibernate.org

org.hibernate.TransactionException: Could not find UserTransaction in JNDI: org.hibernate.transaction.JTATransaction.(JTATransaction.java:64) org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:53) org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:177) org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1279) org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1289) br.com.ReportWizardAdmin.action.categoria.IncluirCategoriaAction.execute(IncluirCategoriaAction.java:95) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:709) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)

43. [solved] Could not find UserTransaction in JNDI    forum.hibernate.org

org.hibernate.TransactionException: Could not find UserTransaction in JNDI: org.hibernate.transaction.JTATransaction.(JTATransaction.java:64) org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:53) org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:177) org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1279) org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1289) br.com.ReportWizardAdmin.action.categoria.IncluirCategoriaAction.execute(IncluirCategoriaAction.java:95) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:709) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)

44. Many-to-many: find all groups that a user is participating    forum.hibernate.org

Hi, I have got a mapping for a User, a Group and a UserGroup. So a user can participate in more than one group and a group can have more than one user. Each domain model object has a Set of the other (a User has a Set of subscribed groups and vice versa). Now I'm searching for a command to ...

46. Not finding things in classpath?!    forum.hibernate.org

Newbie Joined: Sat Jan 20, 2007 10:29 am Posts: 8 Hi, I'm quite a newbie with Hibernate, so please be patient with me. I have a basic servlet that uses Hibernate 3.2 and that I'm trying to get running under Tomcat 5.5. The first weird issue: Code: DEBUG http-8180-Processor25 org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0. dtd] DEBUG http-8180-Processor25 org.hibernate.util.DTDEntityResolver - ...

47. Writing Custom find method    forum.hibernate.org

Hi All Hibernate 3.1 SQL Server 2005 I have the following two tables.. TableA [int colA, int colB, String colC, int data] : primary key [colA+colB+colC] TableB [int colX, int colY, String colZ, int data] : primary Key [colX+colY+colZ] TableA to TableB has 1->Many mapping. Foriegn Key for TableB is Primary Key of TableA. So based on an entry in TableA ...

48. Find amount of queries executed    forum.hibernate.org

49. Could not find UserTransaction    forum.hibernate.org

Hibernate version:3.0 WAS 5.1 SQL Server 2000 In the hibernate.cfg.xml file we have the following data source mapping: org.hibernate.transaction.JTATransactionFactory org.hibernate.transaction.WebSphereTransactionManagerLookup jdbc/data source name In some of the java methods it is throwing the following error. [7/12/07 6:23:37:689 MDT] 6406c8e4 JTATransactio E org.hibernate.transaction.JTATransaction Could not find UserTransaction in JNDI [7/12/07 6:23:37:705 MDT] 6406c8e4 JTATransactio E ...

50. ZipException:The system cannot find the path specified    forum.hibernate.org

Hibernate version: 3.2.6 Name and version of the database you are using: OpenEDGE 10.1B I was able to run the example HelloWorld-Native application fine. I am getting the following error message when I run the example HelloWorld-JPA example application: Exception in thread "main" javax.persistence.PersistenceException: java.util.zip.ZipException: The system cannot find the path specified at javax.persistence.Persistence.findAllProviders(Persistence.java:83) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33) at hello.HelloWorld.main(Unknown Source) ...

51. HibernateOptimisticLockException - how to find problem?    forum.hibernate.org

I inherited some code and am new to Spring and Hibernate. 1) I have a problem where I am getting an exception in my tomcat log (HibernateOptimisticLockingFailureException) and believe it is this: Thread1: A line of code reads some data from the DB (a row from a table) into a hibernate ojbect Thread2: thread2 comes along and writes some data to ...

52. hi can any one find out the mistake in this...    forum.hibernate.org

Contact.java public class Contact { private String firstName; private String lastName; private String email; private long id; public void setFirstName(String firstName) { this.firstName=firstName; } public String getFirstName() { return firstName; } public void setLastName(String lastName) { this.lastName=lastName; } public String getLastName() { return lastName; } public void setEmail(String email) { this.email=email; } public String getEmail() { return email; } public void ...

53. How to find a JNDI resource in the hibernatetool ant task    forum.hibernate.org

Author Message sdelamo Post subject: How to find a JNDI resource in the hibernatetool ant task Posted: Wed Mar 18, 2009 11:37 am Newbie Joined: Thu Oct 26, 2006 1:34 pm Posts: 11 I want to generate my database schema with Ant. I am using hbm2ddl task. I am using Hibernate with JNDI. My hibernate.cfg.xml looks like: Code: ...

54. Can't find hibernate-configuration-3.0.dtd    forum.hibernate.org

Hi all, I'm getting a problem with the declaration of the DTD in the hibernate files (hibernate.cfg.xml as well as *.hbm.xml). The problem appeared while using hibernate in a web application project, in debug, under Eclipse and with a tomcat 6.0 server. There is no problems while testing each module with JUnit. The problems seems to be that hibernate does not ...

55. Hibernate 3.3.2: Could not find UserTransaction in JNDI    forum.hibernate.org

Hi, I upgraded hibernate from 3.2.5 to 3.3.2 Evironment: -WAS 6.1. -hibernate 3.3.2 (upgraded from 3.2.5) cfg: Code: org.hibernate.transaction.JTATransactionFactory org.hibernate.transaction.WebSphereTransactionManagerLookup com.ibm.websphere.naming.WsnInitialContextFactory java:comp/UserTransaction Stack trace: Code: Caused by: org.hibernate.TransactionException: Could not find UserTransaction in JNDI [java:comp/UserTransaction] at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:173) at org.hibernate.transaction.JTATransactionFactory.isTransactionInProgress(JTATransactionFactory.java:245) at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:214) at org.hibernate.impl.SessionImpl.isTransactionInProgress(SessionImpl.java:397) ...

56. Who would find EntityMode.JSON useful?    forum.hibernate.org