EStou tendo problemas para gerar as tabelas pelo hibernate anotations…
tenho a classe gera banco… que teria que gerar as tabelas…
package src.java.br.util;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
public class GeraBanco {
public static void main(String[] args) {
Configuration conf = new AnnotationConfiguration();
conf.configure();
SchemaExport se = new SchemaExport(conf);
se.create(true, true);
}
}
este e o arquivo de configuracao do hibernate…
<?xml version="1.0" ?>
<!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.MySQLDialect</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/pedidocaixa</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"/>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.hbm2ddl.auto">create</property>
<mapping class="src.java.br.objetosVo.EmpresaVo"/>
<mapping class="src.java.br.objetosVo.PerfilVo"/>
<mapping class="src.java.br.objetosVo.PedidoVo"/>
<mapping class="src.java.br.objetosVo.StatusVo"/>
<mapping class="src.java.br.objetosVo.UsuarioVo"/>
</session-factory>
</hibernate-configuration>
e este e um exemplo da classe
@Entity
@Table(name= "statuspedido", schema="anotacoes")
public class StatusVo implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private long idstatus ;
@Column(nullable=false, length=15)
private String descricao;
@OneToMany(mappedBy = "StatusPedidoVo", fetch = FetchType.LAZY)
@Cascade(CascadeType.ALL)
@Column(name= "idstatus")
private Collection<PedidoVo> pedidos;
public StatusVo(){}
========= SETS ======= GETS =======
este e o erro q acontece…
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
compile-single:
run-main:
16:45:17,359 ERROR XMLHelper:61 - Error parsing XML: /hibernate.cfg.xml(15) Attribute “value” must be declared for element type “property”.
Exception in thread “main” org.hibernate.MappingException: invalid configuration
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1493)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:990)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:69)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1434)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:972)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:69)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1420)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:966)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:69)
at src.java.br.util.GeraBanco.main(GeraBanco.java:10)
Caused by: org.xml.sax.SAXParseException: Attribute “value” must be declared for element type “property”.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1490)
… 9 more
Java Result: 1
se alguem puder me ajudar… ficarei muito gratoooo