Posts

Showing posts with the label Exception

java.sql.SQLException: ORA-00926: missing VALUES keyword

As part of Hibernate auto increment practice, I have entered into multiple issue. Here is the one of the exception which I had entered into is  java.sql.SQLException : ORA-00926: missing VALUES keyword . Stacktrace is as follows, Apr 10, 2017 4:48:37 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions WARN: SQL Error: 926, SQLState: 42000 Apr 10, 2017 4:48:37 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: ORA-00926: missing VALUES keyword Apr 10, 2017 4:48:37 PM org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl release INFO: HHH000010: On release of batch it still contained JDBC statements Apr 10, 2017 4:48:37 PM org.hibernate.internal.SessionImpl$5 mapManagedFlushFailure ERROR: HHH000346: Error during managed flush [could not execute statement] Exception in thread "main"  org.hibernate.exception.SQLGrammarException : could not execute statement        at org.hibernate.exception.internal.SQLStateConve

ExceptionInInitializerError in Hibernate

As part of the Hibernate practice, I have faced the  Exception in thread "main" java.lang.ExceptionInInitializerError  at the time of creating the SessionFactory. Here is the full stacktrace which I have captured from console. INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException SessionFactory creation failed.org.hibernate.boot.registry.classloading.spi.ClassLoadingException : Unable to load class [com.javatbrains.sample.User] Exception in thread "main" java.lang.ExceptionInInitializerError        at com.jtb.util.HibernateUtil.buildSessionFactory( HibernateUtil.java:13 )        at com.jtb.util.HibernateUtil.getSessionFactory( HibernateUtil.java:18 )        at com.jtb.test.DeleteUser.main( DeleteUser.java:11 ) Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException : Unable to load class [com.javatbrains.sample.User]        at org.hibernate.

Exception Handling in java with example

Image
Exception occurs only at run-time but some exceptions are detected at compile-time and some others at run-time. The exception that are checked at compilation time by the Java Compiler are called 'Checked exceptions' while the exceptions that are checked by the JVM are called 'Unchecked Exceptions' .        Unchecked exceptions and errors are considered as unrecoverable and the programmer cannot do anything when they occur. The programmer can write a Java program with unchecked exceptions and errors and can compile the program. He can see their effect only when he runs the program. 1 public static void main ( String [] args ) throws IOException        Here, IOException is an example for checked exception. So, we threw it out of main() method without handling it. This is done by throws clause written after main() method in the above statement.             Above diagram explains about the exceptions hierarchy in java. Based on the hierarch