tochar alias problem in h2 1.3.175 version

56 views
Skip to first unread message

Ram

unread,
Mar 20, 2014, 4:46:58 PM3/20/14
to h2-da...@googlegroups.com
hi I`ve a query which works perfectly in Oracle ,
Query q = session.createQuery("select new TESTPOJO(c.name, c.phoneNumber, to_char(c.dateofBirth, 'YYYY') from STUDENT c where c.gender= :gender group by to_char(c.dateofBirth, 'YY') );
q.setString("gender", "Male");
result = q.list();
 
I `m facing issues to run on h2 with to_char().. below is the log
 
java.lang.NullPointerException
 at org.hibernate.internal.util.ReflectHelper.getConstructor(ReflectHelper.java:355)
 at org.hibernate.hql.internal.ast.tree.ConstructorNode.resolveConstructor(ConstructorNode.java:179)
 at org.hibernate.hql.internal.ast.tree.ConstructorNode.prepare(ConstructorNode.java:152)
 at org.hibernate.hql.internal.ast.HqlSqlWalker.processConstructor(HqlSqlWalker.java:1019)
 at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:2150)
 at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:2016)
 at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1451)
 at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:571)
 at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:299)
 at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:247)
 at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:248)
 at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)
 at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
 at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105)
 at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
 at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168)
 at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:219)
 at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:197)
 at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1736)
 
How do i solve this issue.

christof...@finaris.de

unread,
Mar 21, 2014, 5:43:54 AM3/21/14
to h2-da...@googlegroups.com
Hi,

I have the following problem.
My Application uses a H2 database (1.3.171) stored to the hardisk.
I am running a full outer join (implemented by RIGHT OUTER, UNION , LEFT OUTER) between of 2 tables (30 columns each, 1.1 million records each).

On my Windows 7 Test machine, the join completes in about 15 minutes, but on another Windows XP (NTFS file system) machine it takes hours to complete.
I watched the CPU usage of my application on both systems and I noticed that it uses one complete core during the whole time of the join on my Windows 7 Machine. On Windows XP, things seem to be different.
Shortly after starting the join, the CPU usage behaves like on Windows 7. but after some time (The database has grown to approx. 2 GB on harddisk), the CPU usage reduces and oscillates at a quite low amount.

I tested this on several Windows XP machines and the results always seem to be the same.

Is there anything known about this problem (reason, workaround, fix)?

Thanks in advance and kind regards,


Christoff Schmitz

F I N A R I S
Financial Software Partner GmbH
Sömmerringstrasse 23
60322 Frankfurt am Main

Fon:      +49 (0)69  / 254 98 - 24
Mobile: +49 (0)176 / 206 34 186
Fax:       +49 (0)69  / 254 98 - 50
eMail:    
mailto:Christof...@finaris.de
www:      
http://www.finaris.de und http://www.rapidrep.com

================================================================================================================
Disclaimer
The information contained in this e - mail and any attachments ( together the "message") is intended for the addressee only and
may contain confidential and/or privileged information. If you have received the message by mistake please delete it and notify
the sender and do not copy or distribute it or disclose its contents to anyone.

FINARIS Financial Software Partner GmbH, Sömmerringstr. 23, 60322 Frankfurt/Main, Germany
Registered at Frankfurt/Main, HRB 52873, Managing Directors: Dipl. Inf. Hermann Friebel, Dipl. Ing. Kai Bächle, Dipl. Inf. Werner Märkl
================================================================================================================

Noel Grandin

unread,
Mar 25, 2014, 2:30:30 AM3/25/14
to h2-da...@googlegroups.com
Firstly, are you sure that
(a) the machines have similar disk drives?
(b) the machines have similar CPU and memory specs?
(c) you are running the same version of Java and H2 on all the machines?

If all that is true, then you may need to do some profiling to help us identify the problem area:
http://h2database.com/html/performance.html#application_profiling

Regards, Noel.

Ryan How

unread,
Mar 25, 2014, 2:50:05 AM3/25/14
to h2-da...@googlegroups.com
On 21/03/2014 5:43 PM, christof...@finaris.de wrote:
the CPU usage reduces and oscillates at a quite low amount.

Sounds like it may be hitting a memory limit and swapping to disk?

What's your JVM startup parameters? and machine specs?

christof...@finaris.de

unread,
Mar 25, 2014, 3:12:29 AM3/25/14
to h2-da...@googlegroups.com
Hi,

a, b and c are true.
Additionally, I tested the same Join with the Apache Derby Database.
Apache Derby does not show that performance difference between Windows XP and Windows 7 (same Test machines and JVMs used).
For me, the main difference between both databases is the way data is stored to the disk drive. While H2 has one database file, Apache Derby has one per Table or Index.
Since the H2 file is growing to some GB of size, I would assume that this is the problem.

I will try to create a small java program as test case for you within the next days.

Kind regards,


Christoff Schmitz

F I N A R I S
Financial Software Partner GmbH
Sömmerringstrasse 23
60322 Frankfurt am Main

Fon:      +49 (0)69  / 254 98 - 24
Mobile: +49 (0)176 / 206 34 186
Fax:       +49 (0)69  / 254 98 - 50
eMail:    
mailto:Christof...@finaris.de
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at
http://groups.google.com/group/h2-database.
For more options, visit
https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages