Obrgado a todos os programadores que sem fins lucrativos vem me ajudando nesse novo mundo que o java, minha pergunta e senhores programadores :
tenho um sistema que usa o Banco HSQLDB, gostaria de testar ele usando Mysql, esse exemplo que me refiro e o exemplo:
http://sourceforge.net/project/showfiles.php?group_id=158027
usa hibernate + Vraptor
- em baixo o arquivo do hibernate.cfg.xml, como ficaria esse aquivo para o Mysql?
- terei que fazer alguma coisa a mais ?
<?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.HSQLDialect</property>
<property name="hibernate.connection.url">jdbc:hsqldb:file:mydvdsDB</property>
<property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<mapping class="org.vraptor.mydvds.model.Dvd" />
<mapping class="org.vraptor.mydvds.model.User" />
</session-factory>
</hibernate-configuration>
Olá juniorsatanas, vc só precisará mudar o hibernate-dialect para usar o mysql, por exemplo:
org.hibernate.dialect.MySQLDialect = mysql
Lembrando que vc deverá mudar tambem o seu “hibernate.connection.driver_class” para usar o driver para o mysql, e o seu
“hibernate.connection.url” paera acessar o endereço da nova base.
Espero ter ajudado.
mudei tudo mais nao pega !
Junior,
O que acontece? Dá algum erro? Você criou um database no mysql?
fsquadro, sim eu fiz o BANCO com o mesmo nome, e as tabelas com os mesmos ca,pos.
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:36
root cause
java.lang.ExceptionInInitializerError
org.vraptor.mydvds.dao.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:36)
org.vraptor.mydvds.interceptor.DaoInterceptor.intercept(DaoInterceptor.java:41)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:72)
org.vraptor.interceptor.RegisterAttributesInteceptor.intercept(RegisterAttributesInteceptor.java:3
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:72)
org.vraptor.core.VRaptorExecution.execute(VRaptorExecution.java:8
org.vraptor.core.DefaultController.execute(DefaultController.java:42)
org.vraptor.VRaptorServlet.service(VRaptorServlet.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:36
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
Apache Tomcat/5.5.17