¿Alguien tiene un ejemplo de archivo cfg funcional para hibernate 4? Toda la referencia que puedo encontrar en línea es por menos de v4 y eso no funciona. Traté de pegar el contenido de mi archivo aquí, pero este sitio elimina la etiqueta de configuración de hibernación.hibernate.cfg.xml funcional para hibernar 4
así que aquí es lo que sale:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/">
<hibernate-configuration xmlns="http://www.hibernate.org/xsd/hibernate-configuration">
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- Assume test is the database name -->
<property name="hibernate.connection.url">jdbc:mysql://localhost/foampile</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<!-- List of XML mapping files -->
<mapping resource="SiteRecord.hbm.xml"/>
</session-factory>
</hibernate-configuration>
vez que me cambio a
<hibernate-configuration xmlns="http://www.hibernate.org/xsd/hibernate-configuration"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration hibernate-configuration-4.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
me sale esta excepción:
Caused by: org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 63; Attribute "xmlns" must be declared for element type "hibernate-configuration".
PERO xmlns se especifica (xmlns = "http : //www.hibernate.org/xsd/hibernate-configuration ")
¿ES ESTE UN ERROR EN HIBERNATE 4.1 ???
Parece que el problema es con! DOCTYPE pero no sé a qué configurarlo. si lo configuro para el que tiene referencia a v3 DTD, falla al analizar de nuevo y si no incluyo el tipo de documento, se queja de que hibernate-configuration no tiene el atributo xmlns ... SOY EXTREMADAMENTE FRUSTRADO CON ESTO, DESPERDICIADO LAST 2 HRS – amphibient
el documento en línea de Hibernate 4 muestra un ejemplo sin DOCTYPE. – amphibient
http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html/ch01.html#d5e83 – amphibient