Migrating to Hibernate 5: Table ‘crm.hibernate_sequence’ doesn’t exist

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.

@Id
@GeneratedValue
@Column(name=”ID”)
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.

Advertisements

not like condition in hibernate criteria query

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);

c.add(Restrictions.not(Restrictions.like("status", "%CLOSED%")));

javax.validation.ValidationException: HV000183: Unable to load ‘javax.el.ExpressionFactory’. Check that you have the EL dependencies on the classpath, or use ParameterMessageInterpolator instead

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.


<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.4</version>
</dependency>

 

org.hibernate.AssertionFailure: null id in entry (don’t flush the Session after an exception occurs)

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.

Cd1bUvDUUAEo8M4.jpg large

Ticketing management / support desk management with struts, spring and hibernate

Here are the screenshots I promised in my earlier post.

image

Report of the tickets-more filters to be added

image

Details of a ticket and the provision to add the follow-ups if any.

image

Historic report of the followups for the selected ticket.

image

Screen to add a ticket

Delivery 1 is completed yesterday. Lets wait for next release for more features.. Stat tuned!

ஜெய்ஹிந்த்
Posted from WordPress for Android

Ticketing management on SDLC with struts, spring and hibernate

Here are tge screenshots I promised in my earlier post.

image

Report of the tickets-more filters to be added

image

Details of a ticket and the provision to add the follow-ups if any.

image

Historic report of the followups for the selected ticket.

image

Screen to add a ticket

Delivery 1 is completes yesterday. Lets wait for next release for more features.. Stat tuned!

ஜெய்ஹிந்த்
Posted from WordPress for Android