One after another – This was a strange exception I received today. I am not sure if this is a bug of JPA or underlying MySQL.
SQL Error: 1467, SQLState: HY000
Failed to read auto-increment value from storage engine
Servlet.service() for servlet [dispatcherServlet] in context with path  threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement] with root cause
java.sql.SQLException: Failed to read auto-increment value from storage engine
I was pretty much surprised, what else!
Server version: 10.1.36-MariaDB
Spring Boot :: (v2.1.7.RELEASE)
I tried this.
ALTER TABLE `feed_item_info` AUTO_INCREMENT =1
It does not help me.
ALTER TABLE `feed_item_info` ORDER BY `index`
It throws the following warning.
Warning: #1105 ORDER BY ignored as there is a user-defined clustered index in the table ‘feed_item_info’
But it was working.
I shot this recently, at the seashore which borders Singapore and Malaysia
I am in mid of a crud operation. This exception hit me today, when I updated an entity with @ManyToOne(cascade = CascadeType.ALL) relationship.
org.hibernate.PersistentObjectException: detached entity passed to persist: org.grassfield.feed.entity.Feed
To solve this bidirectional consistency problem, I need to change CascadeType.ALL to CasecaseType.MERGE.
Recently I shot this pretty lady (or mighty gentleman?) at Coney Island. This has no relation with this post anyway.
I’m doing upgrading Spring 4 to Spring 5 and Hibernate 4 to 5.
My existing functionality refused to work. It broke with the following exception.
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘crm.hibernate_sequence’ doesn’t exist
I’m using MariaDB/MySQL. I don’t have to maintain any sequence tables as Oracle. In addition, it was working without any issues. All my primary keys are autogenerated with the following annotations.
private Long id;
Thanks to https://stackoverflow.com/questions/32968527/hibernate-sequence-doesnt-exist
Adding hibernate.id.new_generator_mappings=false to Hibernate properties solved the problem.
I have a list of tickets. I want all tickets whose status are not like %CLOSED%. Here is an example using Criteria.
Criteria c = super.getSession().createCriteria(Ticket.class);
I’m writing a unit test for my spring DAO, which includes both write and read test cases. Here is the exception that broke the test execution.
org.hibernate.HibernateException: No Session found for current thread
Any such operations needs @Transactional annotations.
I got this exception when I executed my newly written junit test for a Spring DAO with Hibernate Validations.
After adding javax.el to pom, this is resolved.
I’m inserting multiple records to MySQL with Hibernate 5.
After a constraint failure, all the records are failed to get inserted with the error ‘org.hibernate.AssertionFailure: null id in entry (don’t flush the Session after an exception occurs)’. To get rid of this problem, I cleared the hibernate session when the exception occurs with session.clear().
Data is getting pumped without any problem now.