-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Java Application + Hibernate
PostPosted: Mon Mar 01, 2004 10:04 pm 
Newbie

Joined: Mon Mar 01, 2004 9:49 pm
Posts: 13
Hi,
I am trying to create a java Application that uses hiberante to persist data into mySql.

Getting the following error.
ar 1, 2004 5:44:49 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.2
Mar 1, 2004 5:44:49 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Mar 1, 2004 5:44:49 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Mar 1, 2004 5:44:49 PM net.sf.hibernate.cfg.Configuration addClass
INFO: Mapping resource: com/vizional/vizid/data/bean/EventLog.hbm.xml
Mar 1, 2004 5:44:51 PM net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: com.data.EventLog ->event_log
Mar 1, 2004 5:44:52 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
Mar 1, 2004 5:44:52 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
Mar 1, 2004 5:44:52 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Mar 1, 2004 5:44:52 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
WARNING: No dialect set - using GenericDialect: The dialect was not set. Set the property hibernate.dialect.
Mar 1, 2004 5:44:52 PM net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.GenericDialect
Mar 1, 2004 5:44:52 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use outer join fetching: false
Mar 1, 2004 5:44:52 PM net.sf.hibernate.connection.UserSuppliedConnectionProvider configure
WARNING: No connection properties specified - the user must supply JDBC connections
Mar 1, 2004 5:44:52 PM net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
Mar 1, 2004 5:44:52 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: false
Mar 1, 2004 5:44:52 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): false
Mar 1, 2004 5:44:52 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
Mar 1, 2004 5:44:52 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Mar 1, 2004 5:44:52 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.ehcache.hibernate.Provider
Mar 1, 2004 5:44:52 PM net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
Mar 1, 2004 5:44:53 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Mar 1, 2004 5:44:55 PM net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: no JNDI name configured
java.lang.UnsupportedOperationException: The user must supply a JDBC connection
at net.sf.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:32)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3264)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3244)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:950)
at net.sf.hibernate.loader.Loader.list(Loader.java:941)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1512)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.dao.DaoImpl.getEventLog(DaoImpl.java:56)
at com.dao.DaoImpl.main(DaoImpl.java:146)


Here is my mapping document:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="com.data.bean.EventLog" table="event_log">
<id name="eventLogId" type="string" column="event_log_id" unsaved-value="null">
<generator class="native"/>
</id>
<property name="data" type="string" column="data"/>
<property name="eventTime" type="date" column="event_time"/>
<property name="locationCode" type="string" column="location_code"/>
<property name="readerDomain" type="string" column="reader_domain"/>
</class>
</hibernate-mapping>
<!-- parsed in 0ms -->



and here is my class:

public static void main (String[] args){
DaoImpl dao= new DaoImpl();
try {
dao.getEventLog("Enter Read Event");
} catch (DaoException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public List getEventLog(String eventType) throws DaoException {
Session sess = getSession();
Query q;

String sql="from com.data.EventLog as REL where REL.eventType = ?";
try {
q= sess.createQuery(sql);
q.setString(0, eventType);
List temp= q.list();
return temp;
} catch (HibernateException e) {
throw new DaoException ("Error Creating Query"+e.getMessage());
}
}

Looks like its not able to get Hibernate.properties. But its already in my classpath. Is there anything that I am missing..?

Thanks
Rajeev.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 10:23 pm 
Beginner
Beginner

Joined: Tue Jan 27, 2004 2:14 pm
Posts: 40
Location: Atlanta, GA, USA
It might help to post your hibernate.properties file. Also are you sure it's in your CLASSPATH?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 11:51 pm 
Newbie

Joined: Wed Feb 25, 2004 11:41 pm
Posts: 19
Location: China
make sure you have config your mysql-JDBC driver....

_________________
who can tell me why?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.