Migrating an app from WebLogic/JSF 1.2 to JBoss/JSF 2.0

Several things that have arisen over the course of this migration – so I’ll deal with them as they arise. Some are errors, some are not – but links to things that are useful to record.

Hibernate error:

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

What happened here, is that as Cedar715 (Jai) points out, on his blogpost that Hibernate tried to map the entity – and did not like the type that it found.

In my specific case.

@Column(nullable = false, length = 1)
private String loglevel = "I"; 

was the one that was not liked.

Here, we are storing the “loglevel” in the database as a single char.

The sqldeveloper snippet of the table is:


The definition was for a single char, however the variable loglevel is a


By default, the Hibernate converts java.lang.String to varchar2(255) – so we have a type mismatch.
Because the persistence.xml has schema validation turned on

<property name="hibernate.hbm2ddl.auto" value="validate"/>

it will throw the error.


Add a column definition – below.

@Column(nullable = false, columnDefinition = "char", length = 1)
private String loglevel = "I";
This entry was posted in java, Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s