hibernate.cfg.xml
?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.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.CharSet">utf8</property>
<property name="hibernate.connection.characterEncoding">utf8</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/UsoSurvey</property>
<property name="hibernate.connection.username">UsoSurvey</property>
<property name="hibernate.connection.password">UsoSurvey</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.current_session_context_class">thread</property>
<!-- configuration pool via c3p0-->
<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.idle_test_period">100</property> <!-- seconds -->
<property name="c3p0.max_size">10</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">1</property>
<property name="c3p0.timeout">100</property> <!-- seconds -->
<mapping class="Modelo.Grpusuario"/>
<mapping class="Modelo.Menu"/>
<mapping class="Modelo.Encuesta"/>
...
在iReport中 工具 - &GT;选项 - &GT; iReport-&GT;类路径
C:\ Users \ Administrador \ Documents \ NetBeansProjects \ UsoSurvey \ src \ java \ Util - &gt;我*这个文件夹是映射类*
C:\ Users \ Administrador \ Documents \ NetBeansProjects \ UsoSurvey \ src \ java \ Modelo - &gt; 在此文件夹中是模型类
Grpusuario.java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Modelo;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author Administrador
*/
@Entity
@Table(name = "grpusuarios", catalog = "UsoSurvey", schema = "")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Grpusuario.findAll", query = "SELECT g FROM Grpusuario g"),
@NamedQuery(name = "Grpusuario.findByGrupo", query = "SELECT g FROM Grpusuario g WHERE g.grupo = :grupo"),
@NamedQuery(name = "Grpusuario.findByDescripcion", query = "SELECT g FROM Grpusuario g WHERE g.descripcion = :descripcion")})
public class Grpusuario implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Column(name = "grupo")
private Integer grupo;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 64)
@Column(name = "descripcion")
private String descripcion;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "secLevel")
private Collection<Menu> menuCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "grupo", orphanRemoval = true)
private Collection<Usuario> usuarioCollection;
public Grpusuario() {
}
....
但是在尝试创建连接时,我收到以下错误:无法加载配置中声明为< mapping class="Modelo.Grpusuario" />
的类