time « Query « JPA Q&A





1. Hibernate group by time interval    stackoverflow.com

I have a table with a timestamp field of type datetime. I need to aggregate the data between a defined start and end time into x groups representing time intervals of ...

2. select statement get time duration    stackoverflow.com

let say i have table look like below

actionTable
-----------
id, user, actionName, time
1 , userX, startdoing,  1/1/2010 9am
2, userX, endDoing,     2/1/2010 10am
may i know whether possible to use ...

3. Basic date/time manipulation in NHiberate query    stackoverflow.com

I'm trying to restrict my NHibernate query with some basic date/time manipulation. More specifically, I want to execute the following statement (pseudo-SQL):

select * from article where created_on + lifespan >= sysdate
with:
  • created_on ...

4. Working with part of a query at a time    stackoverflow.com

I have a hibernate query which returns 10s of thousands of object results. Is it possible to cycle through chunks of the query rather than handling the entire query at ...

5. joda.time.DateTime with hibernate createQuery to setDate    stackoverflow.com

pojo

public class RateCode implements java.io.Serializable {

     private org.joda.time.DateTime travelTo;
     private org.joda.time.DateTime bookingFrom;
}
Query
Query q = session.createQuery(
        ...

6. hibernate query much slower than native query on db    stackoverflow.com

I have a Mysql db an a simple querry and I noticed a difference in a query time when executing the query trugh the hibernate query editor in Eclipse and executing ...

7. JPA query for day ignoring the time    stackoverflow.com

Let say you have a class with a java.util.Date field. Maybe a To do class or an Event planner class.

@Temporal(TemporalType.TIMESTAMP)
private Date startTime;
This will map to a datetime column in MySQL. There are ...

9. select using hibernate - TIME dataype    coderanch.com

You also have to remember that if you have a Timestamp in the DB and take it out, Hibernate takes it as a date, you lose precision... Or am I backwards? Anywho, to keep your precision you need to write a custom type to type cast properly. There are some good dicusions of this at the official forums.





10. Hibernate Query taking long time    coderanch.com

Hi All, I have a hibernate criteria query running on tables which have huge amount of data around 29L rows in the largest one. But the conditions in the query are such that the number of rows in the final output are only 365. The query is taking such a long time if run through application that the transaction gets timeout ...

11. Same query giving different results over time    forum.hibernate.org

Newbie Joined: Thu Oct 01, 2009 5:18 pm Posts: 2 Hi, I'm having a problem with Hibernate so I prepared the following test case to reproduce it easier. I have 2 entities (Usuario and Grupo) with a OneToMany bidirectional relationship. I'm doing some inserts followed by a query (checking if the insert worked). I can retrieve the entity but can't follow ...

12. Criteria Order not effectiveness all the time    forum.hibernate.org

13. SQL query takes very long time    forum.hibernate.org

I am using HIbernate 3.1.3 RAD 7 compiling to jre 1.4 Oracle 9 A query which I can ran in few seconds in a sql client takes long time 2 to 3 minths to run through hibernate I use plain sql and not HSQL I nerrow down the problem to this line of code ResultSet rs = ps.executeQuery(); in AbstractBatcher public ...

14. Time missing from Oracle Date in Native Query ?    forum.hibernate.org

I have a native query that returns a date field (select ... EVENT_DATE ... from ...). The Sql Mapping: @SqlResultSetMapping(name = "resultSet", columns = { @ColumnResult(name = "STATUS_CD"), @ColumnResult(name = "DESCRIPTION"), @ColumnResult(name = "EVENT_DATE"), @ColumnResult(name = "LOCATION") }) I use: private static final SimpleDateFormat eventDateFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm a"); eventDateFormat.format(_events[2]); The time portion is always 0. (12:00 AM). How can ...

15. Time value in Java Date object not used in query    forum.hibernate.org

16. DELETE, then INSERT statements every time I SELECT    forum.hibernate.org

Hi, I am having an unexpected behavior when I do a SELECT query. I have an entity with a collection of embeddable elements. These are the mappings: Code: @Entity @Table(name = "document") public class Document extends AbstractEntity { // Integer id in AbstractEntity private Integer typeId; private Set propertyValues = Sets.newHashSet(); ...





17. How to specify "select-for-update with a wait time"?    forum.hibernate.org

How to specify "select-for-update with a wait time" from Java code using Jdbc and Hibernate? Hibernate provides lock mode - LockMode.UPGRADE_NOWAIT. What lock mode should be used to WAIT for given time? We are using ojdbc6.jar (11.1 driver) to connect to database from our Java Code, which is a Java enterprise application running on Weblogic 10.3.3. We are using Hibernate 3.3.2 ...

18. Query creation time and Session association    forum.hibernate.org

Hello First of all thank you all for the work done. I am currently testing a newly developed application based on stateless EJB sessions executing many HQL queries. One of the bottlenecks in the application is the memory consumed by HQL query instanciations. Given a HQL string, why hibernate must re-parse and regenerate a QueryImpl each time a session.createQuery is achieved ...

19. Can one-to-many be selected one time?    forum.hibernate.org

My xml configuration is like this: h2 will select main table at first then select another table (BidPackageModel)by every result record in main table. It will generate many sql. Can I config something to let h2 select master and slave table together then auto split records into correct java class?

20. Hibernate's ability to query time    forum.hibernate.org

I have the following problem: I have a row in my Oracle 9 database with a field "Time" of type DATE. In this field is the following: 2000-01-01 01:34:56 When I do a Hibernate comparison (Expression.ge etc...) it doesn't do the comparison on the time properly, even though its mapped through java.sql.Time to a custom Time type (that extends java.util.Date). I ...

21. query-time cache preferences    forum.hibernate.org

22. time insensitive date comparison in WHERE clause    forum.hibernate.org

I have trouble getting the following query to return anything at all: final Query query = session.createQuery( " FROM FXRate AS fxr " + " WHERE fxr.baseCurrencyId = :base " + " AND fxr.ratedCurrencyId = :rated " + " AND fxr.effectiveDate = :date" ); query.setParameter("base", base.getId()); query.setParameter("rated", rated.getId()); query.setParameter("date", calendar); Yet I know that the combination of values I pass exists ...

23. createSQLQuery and time stamp    forum.hibernate.org

24. HQL: time interval query    forum.hibernate.org

Hi there, I would like to perform a query on object which contains Date attribute and limit result set to specified date-time period and then specify also the time interval. For example, I'm interested in all objects between date1 and date2 and then inside this time period I would like to get all objects between 12:00 and 14:00. I know how ...

25. Why hibernate query database after I refresh page five time    forum.hibernate.org

Session _session=HibernateUtil.currentSession(); Transaction t=_session.beginTransaction(); String sql="select element(p.child) from Parent p where p.user_name='"+logonName+"'"; log.info("Get sell SQL>>> "+sql); List childList=_session.find(sql); log.info("Get sellsize: >>"+sellhouseList.size()); ...

26. "All Cats" query response time (100000 cats)    forum.hibernate.org

Hi there, I do recognized a huge performance bottleneck when using HQL or Hibernate SQL: Retrieving 100000 cats takes 18 secs. But: The answering time when using a JDBC select loop (see code below) is just 70 Millisecs ?! (MS SQL Server 2000) . Any comment is appreciated, because I deal with such an amount of document objects. Of course, the ...

27. Performing N selects (N small), some select takes long time.    forum.hibernate.org

Hello, I'm using b]Hibernate 3.0[/b], Tomcat 5.0.28, JDK 1.4.2_07 and Jtds 1.0.2 and MS SQL sever I have a big flat table containing about 200 fields. This table has few millions rows. For a given list of fields I want to get one value (any) and also the list of all the distinct value for that field. Let say I need ...

28. Use Example/Criteria to build query w/ Date/time comparison    forum.hibernate.org

I have a class called User, which has a few properties. One of the properties is last time a user logged into the application. I am writing some code for searching for users who logged into the application before a certain time point. I use Hibernate's Example and Criteria to build the query code as follows: Example exampleUser = Example.create(user).ignoreCase().enableLike(MatchMode.ANYWHERE); SimpleDateFormat ...

29. Query Database Time with Hibernate?    forum.hibernate.org

In general, using time/date to synchronize is troublesome and error prone. With that disclaimer : If you only want to work with a single server db (or a couple) then you might try : DatabaseMetaData meta = connection.getMetaData(); // Get the list of time and date functions String timedateFunctions[] = meta.getTimeDateFunctions().split(",\\s*"); This will give you a list of the db specific ...

30. Need your expertise to avoid firing queries every time    forum.hibernate.org

The generated SQL (show_sql=true): select MIN(sbbid0_.PER_HOUR_RATE) as col_0_0_, sbbid0_.REQ_LINE_ITEM_ID as col_1_0_, sbbid0_.REQUIREMENT_ID as col_2_0_ from BID sbbid0_, REQ_LINE_ITEM sbreqlinei1_ where (sbbid0_.BID_STATUS_CODE in (10 , 40 , 50 , 60 , 61 , 70 , 80 , 90 , 95 , 33 , 43)) and (sbbid0_.BID_STATUS_CODE not in (33 , 43)) and sbbid0_.DELETION_MARK=0 and sbbid0_.FIT_PERCENTAGE>=sbreqlinei1_.THRESHOLD_OF_FIT and sbreqlinei1_.DELETION_MARK<>1 and sbbid0_.COST_OF_SKILLS>=(select min(sbbid2_.COST_OF_SKILLS) from BID ...

31. Querying separately versioned entities at a point in time.    forum.hibernate.org

Newbie Joined: Tue Apr 25, 2006 10:34 pm Posts: 3 Hi, I am trying to create a new database where each entity is versioned. This means that I have an id(catalog number) for each entity that is constant over time. I also have an id for each version (serial number). Each version has two dates corresponding to validfrom/validto of that particular ...

32. Time to process queries through criteria api and EM queries    forum.hibernate.org

hi, i had a problem that i solved 1 week ago, but that is not the reason i am posting here. The Problem I had to make a query to get some results, but the problem was if i did it through criteria api it took around 30 secods for return the resuts!. If if did it with directly query through ...

33. Query by time against timestamps    forum.hibernate.org

I have a table with a timestamp field and multiple records with this field set to different days and times. I have to extract every record where the timestamp field is included in a time interval, like this TIME1 < TIME(rec.timestamp) < TIME2 which include records even of different days. how can I do this? I've googled extensively but still not ...

36. Huge query takes too long 1st time executed, workarounds?    forum.hibernate.org

I have a huge query (10 A4 sheets if you print it) which returns 3 rows. If you open it with SQLPlus (Oracle) the first time you run it takes ~3 minutes to run. The 2nd time, just 8 miliseconds. My DBA is tracing it and he thinks the problem is not the query itself (few data, right use of indexes ...

37. how to get date and time in Criteria with projections    forum.hibernate.org

Hi All, i have a date column in Database. but i want to display date and time in presentation part. my code snippet is setProjection(Projections.property("runTimestamp")); but when i used this property i can able to display only date like 28-Aug-2008. please do the needful to display date and time. thanks in advance. Regards, Purushotham Podaralla

38. Help: HQL query to select first records in time interval.    forum.hibernate.org

I need to report on the total consumption of all the devices during a time interval (say, a day), and how many devices' reading i used. To get an accurate report, for each device, the difference between the first reading (minimum reading) of the current time interval and the next time interval must be calculated.

39. oracle: group by time    forum.hibernate.org

40. Class.getInterfaces() takes 80% cpu time on repeated Query    forum.hibernate.org

I'm running a query that returns ~ 100 objects per query in a loop that executes ~ 6000 times (iterating over a different search key for each query). I put some profiling code on the process since it was taking longer than I expected (-agentlib:hprof=cpu=samples,depth=10). Normally, I'd expect the process to be bound by the database, so most of the time ...

41. One-time translation of HQL queries    forum.hibernate.org

Concrete implementation of the SessionFactory interface. Has the following responsibilites caches configuration settings (immutably) caches "compiled" mappings ie. EntityPersisters and CollectionPersisters (immutable) caches "compiled" queries (memory sensitive cache) manages PreparedStatements delegates JDBC Connection management to the ConnectionProvider factory for instances of SessionImpl This class must appear immutable to clients, even if it does all kinds of caching and pooling under the ...