-->
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.  [ 1 post ] 
Author Message
 Post subject: [Help] Exception in thread "main" org.hibernate.HibernateExc
PostPosted: Thu May 19, 2011 2:43 am 
Newbie

Joined: Thu May 19, 2011 2:36 am
Posts: 3
Masters...
Need help here..i'm new in java and i want to try hibernate feature..but i have some problem..
-------------
My Main Code :
public static void main(String[] args){
SessionFactory sf = new Configuration().buildSessionFactory();

VisitorType vt = new VisitorType();

vt.setTypeCode("A");
vt.setTypeName("B");

Session session = sf.openSession();

try {
session.beginTransaction();
session.save(vt);
session.getTransaction().commit();
} catch (HibernateException hibernateException) {
session.getTransaction().rollback();
}
session.close();

session = sf.openSession();
Query query = session.createQuery("from Person");
List<VisitorType> vts = query.list();
for (VisitorType visitorType : vts) {
System.out.println("code : " + visitorType.getTypeCode());
System.out.println("name : " + visitorType.getTypeName());
}

session.close();
sf.close();
}
---------
my hibernate config :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:sqlserver://192.168.0.107;databaseName=dbMayoraOfficeAutomation</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password">sa</property>
</session-factory>
</hibernate-configuration>
---------
my error msg :
May 19, 2011 1:18:26 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.5
May 19, 2011 1:18:27 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
May 19, 2011 1:18:27 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
May 19, 2011 1:18:27 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
May 19, 2011 1:18:27 PM org.hibernate.connection.UserSuppliedConnectionProvider configure
WARNING: No connection properties specified - the user must supply JDBC connections
Exception in thread "main" org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at MYR.OA.APP.Test.main(Test.java:21)
Java Result: 1
---------
please help, what should i do??
do i need to create another JDBC??


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

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.