Thursday 26 November 2009

Sequences not allowed here

OK, this was just annoying, but since I couldn't find anything on the web when I looked, here's what my problem was:

I was modifying some hibernate code to use the SequenceStyleGenerator annotation, so it will work cross-DB. I'd initially developed using MySQL, and had a MySQL hibernate dialect specified in my config files. I exported the schema to an Oracle XE instance using hbm2ddl in Eclipse, and started using an Oracle driver in my datasource.

Every time I tried to insert anything, I got an oracle error - Sequence not allowed here. Ultimately, just removing the dialect entirely from the config files worked, since Hibernate can auto-detect the dialect most of the time.

Hibernate / Spring WAR issues in Weblogic 10 - antlr

I had an issue today deploying a straightforward WAR file to WLS 10. The classloader hierarchy was preventing Hibernate from using the correct version of the antlr jar that was bundled in my webapp.

For my particular situation, the solution had to be simple. In the end, I created a new Eclipse project to bundle the WAR into an EAR, and then added a file called weblogic-application.xml in the META-INF folder of that EAR with the following content:


<weblogic-application>
<prefer-application-packages>
<package-name>antlr.*</package-name>
</prefer-application-packages>
</weblogic-application>


..which solves the problem.

Wednesday 11 November 2009