Wednesday, October 14, 2009

Passion

It’s passion that makes the difference
Between a good performance and an inspiring performance
to go beyond competence.
It’s passion that lifts a person head and shoulders
above the rest in difficult times.

A strong commitment brings your whole being
into play – body, mind, and spirit,
making you feel more vital and fully alive;
enabling you to tap inner strengths,
resources, abilities and energies
that you didn’t know existed.

When you have fire in your heart, it lifts your entire life;
days go faster, life’s chores become more interesting.
you gain more resilience, more buoyancy,
and when you are spirited,
it radiates to every one around you.

 

 

EasyMock Weird Error

java.lang.NoSuchMethodError: org.easymock.internal.RecordState.(Lorg/easymock/internal/IMocksBehavior;)V
at org.easymock.internal.MocksControl.reset(MocksControl.java:66)
at org.easymock.internal.MocksControl.(MocksControl.java:29)
at org.easymock.classextension.internal.MocksClassControl.(MocksClassControl.java:19
)

As a thumb rule…
Should you find any “L”s or “V”s in the exception stack trace, just check your CLASSPATH. There might be class files(jar files) conflict. Don’t just get bluffed by the Exception message: NoSuchMethodError. The Class and the method will be there…but it might be there more than ONCE.

I got this message while I was trying PowerMock. This distribution has its own EasyMock jar file and my project is also referencing an existing (old version) easy mock jar file. This was fixed when I reorderd the jar file in Order & Export tab of Eclipse’s Java Build Path.

org.hibernate.HibernateException: Wrong column type Found: char, expected: varchar2(255)

Problem:
org.hibernate.HibernateException: Wrong column type Found: char, expected: varchar2(255)

This exception was raised for the mapping:

@Column(name = "CNTRY_NM")
public String getCountry() {
return country;
}

Analysis: This means to say that Hibernate has found char as the dataType of the column in the DATABASE and in your mapping you specified the data type as String.

    By default, the Hibernate converts java.lang.String to varchar2(255).

In other words, the data type of ‘CNTRY_NM’ column was defined as CHAR(50 Byte) in the database. Where as the data type of the corresponding attribute in the Entity class is java.lang.String. As there is a mismatch in the columns, the exception is thrown. When you specify schema validation by Hibernate (hibernate.hbm2ddl.auto = validate) this exception is thrown.

Solution:
@Column(name = "CNTRY_NM", columnDefinition = "char")
public String getCountry() {
return country;
}


Followers