Posts

Showing posts with the label Hibernate

Caused by: java.sql.SQLTimeoutException: ORA-01013: user requested cancel of current operation

Many times we encounter this error and think that there might be some JPA issue or network issue. However, the error is pretty explicit in its nature, but still not clear to ring the bell very first time. As the error says there is a timeout, and since Oracle is saying, we shall accept it. Another clue is "user requested cancel of current operation". This means that the connection was closed by the application server not the database server, hence it can be safely concluded that application has configured timeouts on transactions at its end. However, if you feel that this transaction should have been concluded within the application server limits, your doubt might be true. This problem can arise in case there is a lock on the record being updated by JPA or lock on the table in which JPA is attempting to insert. The lock is most probably being held by some other application, and since application server configuration is on aggressive SLA, the transaction is waiting its...

hbm2ddl -- the problems and remedy

For a project I had to create ddl from the hibernate mapping files (hbm.xml). I started with following configuration. Remember you need not have database details of hibernate.cfg.xml file hibernate.cfg.xml <hibernate-configuration>   <session-factory>     <mapping resource="com/gvt/sch/hibernate/ApplicationEnvironment.hbm.xml"/>     <mapping resource="com/gvt/sch/hibernate/UserRole.hbm.xml"/>     <mapping resource="com/gvt/sch/hibernate/Application.hbm.xml"/>     <mapping resource="com/gvt/sch/hibernate/TaskType.hbm.xml"/>     <mapping resource="com/gvt/sch/hibernate/WorkStatus.hbm.xml"/>     <mapping resource="com/gvt/sch/hibernate/Users.hbm.xml"/>     <mapping resource="com/gvt/sch/hibernate/Roles.hbm.xml"/>     <mapping resource="com/gvt/sch/hibernate/Contacts.hbm.xml"/>     <mapp...

Error while creating hibernate session factory bean

Error Text: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream There are two probable reasons for this situation in my experience. Some of them are as follows 1. The "id" is not present in one or more mapping files (hbm.xml) 2. The DTD definition may be wrong, try replacing following with later. <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">