Hello,
I have a problem with a "createQuery()" in hibernate 3.0 rc1. I have mapped a bean to the Postgresql 7.4 DB and stored the data. When I try to get the data back I get an Exception. It is my first hibernate project please point me in the right direction because I am seriously stuck.
Greetings
Sven
The stacktrace:
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@16672d6 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@cf40f5 [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 5, maxIdleTime -> 1800, maxPoolSize -> 20, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@b82368 [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:postgresql://localhost/sven, properties -> {user=******, password=******} ] , preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ] , factoryClassLocation -> null, numHelperThreads -> 3, poolOwnerIdentityToken -> 16672d6 ]
Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ANTLRException
at org.hibernate.hql.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:27)
at org.hibernate.impl.SessionFactoryImpl.createQueryTranslators(SessionFactoryImpl.java:344)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:410)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:814)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:773)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:569)
at persistence.HInterface.getUser(HInterface.java:32)
at persistence.Hibernate_Test.main(Hibernate_Test.java:30)
My Java code looks like this:
Transaction ta = s.beginTransaction();
u = (Users) s.createQuery("from Users as u where u.UserName=?").setString(0, username).uniqueResult();
ta.commit();
My Mapping file looks like this:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="persistence.Users"
table="USERS"
lazy="true"
>
<id
name="id"
column="USER_ID"
type="java.lang.Long"
>
<generator class="native">
</generator>
</id>
<property
name="fromhost"
type="java.lang.String"
column="FROMHOST"
/>
<property
name="mbox"
type="java.lang.String"
column="MBOX"
/>
<property
name="passwd"
type="java.lang.String"
column="PASSWD"
/>
<property
name="port"
type="java.lang.Integer"
column="PORT"
/>
<property
name="protocol"
type="java.lang.String"
column="PROTOCOL"
/>
<property
name="tohost"
type="java.lang.String"
column="TOHOST"
/>
<property
name="userName"
type="java.lang.String"
column="USERNAME"
not-null="true"
unique="true"
/>
</class>
</hibernate-mapping>
|