-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Exception on criteria with enum with Oracle
PostPosted: Thu Apr 06, 2017 9:37 am 
Newbie

Joined: Thu Apr 06, 2017 3:25 am
Posts: 1
Dear all,
I need to migrate my java application from mysql to oracle 11g.
First of all I changed connection string and application now links correctly to oracle.
I've an issue with criteria working.
I've a criteria

Code:
Criteria foldersCriteria = createCriteria(BCKFolder.class);
            foldersCriteria.add(Restrictions.ne("status", BackupFolderStatuses.CLOSE));
            foldersCriteria.addOrder(Order.asc("status"));
            foldersCriteria.addOrder(Order.asc("order"));
            List<BCKFolder> folders = foldersCriteria.list();


where "BackupFolderStatuses" is an enum field.
This is how enum is defined

Code:
public enum BackupFolderStatuses
{
    READY, IN_USE, CLOSE;
   
    public String toString()
    {
        return ResourcesHelper.getString(EnumHelper.toStringFormatter(this));
    };
   
}


At criteria creation moment debug shows me
Code:
com.sun.jdi.InvocationException occurred invoking method.


but when criteria is executed (" foldersCriteria.list()"), my application throws exception

Code:
2017-04-06 14:37:12,486 [ERROR] it.nexera.web.services.PathCheckerService java.lang.NullPointerException at it.nexera.common.helpers.LogHelper.log(LogHelper.java:28)
2017-04-06 14:37:12,486 [ERROR] it.nexera.web.services.PathCheckerService java.lang.NullPointerException
    at it.nexera.web.services.PathCheckerService.createMessage(PathCheckerService.java:209)
    at it.nexera.web.services.PathCheckerService.checkFolder(PathCheckerService.java:148)
    at it.nexera.web.services.PathCheckerService.checkPath(PathCheckerService.java:85)
    at it.nexera.web.services.PathCheckerService.routineFuncInternal(PathCheckerService.java:68)
    at it.nexera.web.services.base.BaseService.routineFunc(BaseService.java:188)
    at it.nexera.web.services.base.BaseDBService.runInternal(BaseDBService.java:59)
    at it.nexera.web.services.base.BaseService.run(BaseService.java:99)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)
at it.nexera.common.helpers.LogHelper.log(LogHelper.java:29)


Please consider that the same code works like a charm with MySql.
Can you help me please?
Thanks,
Best Regards


Top
 Profile  
 
 Post subject: Re: Exception on criteria with enum with Oracle
PostPosted: Thu Apr 06, 2017 10:36 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
From the StackTrace, it looks slike the NullPointer is in your code, not Hibernate.

Put a debug breakpoint at this line and see what causes the NPE:

Code:
it.nexera.web.services.PathCheckerService.createMessage(PathCheckerService.java:209)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.