As we can see here you have closed connection to DB in that time when you try to setString do.
The way It is possible
- When you don’t create any connection to DB
- When you create but don’t open any connection to DB
- When you create and, even open, but, close connection before tries to make DML into DB.
More Related Contents:
- Getting Database connection in pure JPA setup
- JPA SQL Server No Dialect mapping for JDBC type: -9
- How to call Oracle Function or Procedure using Hibernate (EntityManager) or JPA
- Connection cannot be cast to oracle.jdbc.OracleConnection
- Hibernate native query – char(3) column
- How to map a composite key with JPA and Hibernate?
- Using setDate in PreparedStatement
- Do I need elements in persistence.xml?
- What is the difference between persist() and merge() in JPA and Hibernate?
- Why do I get java.lang.AbstractMethodError when trying to load a blob in the db?
- ImprovedNamingStrategy no longer working in Hibernate 5
- Correct use of flush() in JPA/Hibernate
- JPA & Criteria API – Select only specific columns
- How does the JPA @SequenceGenerator annotation work
- How do I properly cascade save a one-to-one, bidirectional relationship on primary key in Hibernate 3.6
- Spring data JPA and hibernate detached entity passed to persist on ManyToMany relationship
- How to map the result set of a JPA NativeQuery to a POJO using SqlResultSetMapping
- How to call an Oracle function from Hibernate with a return parameter?
- Refresh and fetch an entity after save (JPA/Spring Data/Hibernate)
- Have JPA/Hibernate to replicate the “ON DELETE SET NULL” functionality
- Doing an “IN” query with Hibernate
- How can I avoid the Warning “firstResult/maxResults specified with collection fetch; applying in memory!” when using Hibernate?
- @Id @GeneratedValue but set own ID value
- Difference between save and saveAndFlush in Spring data jpa
- Inherited abstract class with JPA (+Hibernate)
- The onFlushDirty Hibernate Interceptor method is never called
- org.hibernate.MappingException: Could not determine type for: java.util.Set [duplicate]
- Difference between @MapKey, @MapKeyColumn and @MapKeyJoinColumn in JPA and Hibernate
- Oracle’s RETURNING INTO usage in Java (JDBC, Prepared Statement)
- Why hibernate generates insert and update for OneToMany mapping