Stephen on Software aka SOS

December 2, 2009

Hibernate 3: illegal syntax near collection using ClassicQueryTranslatorFactory

Filed under: Uncategorized — Tags: , — sljm @ 4:58 pm

Got this error “illegal syntax near collection”, the HQL query was something like this

"select p.alias from Person p inner join p.telephoneNos where p.telephoneNos=?".

Person has a one-to-many with telephoneNos and a one-to-many with alias. With the new ASTQueryTranslatorFactory the query works fine, with the old ClassicQueryTranslatorFactory there is an error.

After some fiddling around with the query, the error seems to from the “select p.alias” part. It seems like it can’t parse p.alias. When i change it to just p, it works fine.

So for those using the old query translator do take note of this. Caught me by surprise, so it seems that there is a difference in the old and new query translator.

But why am I using the old translator, in Weblogic Server 10 (or 11g as Oracle now calls it), there is a class loading conflict, they loaded some jars (can’t remember which), so I used the old query translator instead.

You can change the query translator by using the following in your hibernate.properties.

hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory

November 10, 2009

Weblogic and Spring Security problems

Filed under: Programming — Tags: , — sljm @ 2:58 pm

When depolying Spring Security on Weblogic 10.3. I encountered 2 pop up one for Spring and one for Weblogic.

Spring Security was configured with basic authentication. If your used is not in Weblogic’s security realm basically you dont get access. Some people also faced the same problem and here are their solutions.

If you use the form base authentication, you should be fine. It just happens for those who use the default basic/digest forms that your web browser provides.

1. Configure web.xml

<login-config>
<auth-method>CLIENT-CERT</auth-method>
</login-config>

add the above to your web.xml.

alternatively you can try this.

2. Edit weblogic config/config.xml
Add the following lines to config.xml in your admin server.

<enforce-valid-basic-auth-credentials>
    false
</enforce-valid-basic-auth-credentials>

Blog at WordPress.com.