我的项目出现此错误,我没有弄错,这是浏览器的错误日志。 log.txt
我不知道什么是兼容的,这些库是导入的
.:
activation-1.1.jar
antlr-2.7.6.jar
antlr-runtime-3.1.1.jar
c3p0-0.9.1.jar
chenillekit-core-1.3.2.jar
chenillekit-google-1.3.2.jar
chenillekit-hibernate-1.3.2.jar
chenillekit-image-1.3.2.jar
chenillekit-tapestry-1.3.2.jar
commons-beanutils-1.7.0.jar
commons-beanutils-core-1.8.0.jar
commons-codec-1.3.jar
commons-collections-3.2.1.jar
commons-configuration-1.6.jar
commons-digester-1.8.jar
commons-fileupload-1.2.jar
commons-io-1.3.jar
commons-lang-2.4.jar
CopyLibs
dom4j-1.6.1.jar
eclipselink
eclipselinkmodelgen
ejb3-persistence
geronimo-spec-jta-1.0-M1.jar
hibernate-c3p0-3.6.0.Final.jar
hibernate-commons-annotations-3.2.0.Final.jar
hibernate-core-3.6.0.Final.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
hibernate-support
javaee-endorsed-api-6.0
javaee-endorsed-api-6.0-2
javassist-3.12.1.GA.jar
jsontools-core-1.5.jar
junit
junit-3.8.2.jar
junit_4
junit-4.5.jar
junit-4.5-src.jar
kaptcha-2.3.2.jar
libs
log4j-1.2.14.jar
mail-1.4.jar
mysql-connector-java-5.1.13-bin.jar
mysql-connector-java-5.1.6.jar
nblibraries-private.properties
nblibraries.properties
ognl-2.7.3.jar
org-netbeans-modules-java-j2seproject-copylibstask.jar
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar
Tap5
tapestry5-annotations-5.2.4.jar
tapestry-core-5.2.6.jar
tapestry-func-5.2.4.jar
tapestry-hibernate-5.2.6.jar
tapestry-hibernate-core-5.2.6.jar
tapestry-ioc-5.2.4.jar
tapestry-json-5.2.6.jar
tapestry-upload-5.2.4.jar
tapx-core-1.1-20110620.210912-27.jar
tapx-core-1.2-20110705.222421-4.jar
tapx-datefield-1.1-20110617.214353-17.jar
tapx-datefield-1.2-20110705.222544-4.jar
./CopyLibs:
org-netbeans-modules-java-j2seproject-copylibstask.jar
./eclipselink:
eclipselink-2.2.0.jar
eclipselink-javax.persistence-2.0.jar
./eclipselinkmodelgen:
eclipselink-jpa-modelgen-2.2.0.jar
./ejb3-persistence:
ejb3-persistence.jar
./hibernate-support:
antlr-2.7.6.jar
asm-attrs.jar
asm.jar
cglib-2.1.3.jar
commons-collections-2.1.1.jar
commons-logging-1.1.jar
dom4j-1.6.1.jar
ehcache-1.2.3.jar
hibernate3.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
hibernate-tools.jar
javassist.jar
jdbc2_0-stdext.jar
jta.jar
./javaee-endorsed-api-6.0:
javaee6-doc-api.zip
javax.annotation.jar
jaxb-api-osgi.jar
webservices-api-osgi.jar
./javaee-endorsed-api-6.0-2:
javaee6-doc-api.zip
javax.annotation.jar
jaxb-api-osgi.jar
webservices-api-osgi.jar
./junit:
junit-3.8.2-api.zip
junit-3.8.2.jar
./junit_4:
junit-4.5-api.zip
junit-4.5.jar
junit-4.5-src.jar
./Tap5:
antlr-2.7.6.jar
antlr-runtime-3.1.1.jar
asm-1.5.3.jar
asm-attrs-1.5.3.jar
cglib-2.1_3.jar
commons-codec-1.3.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
dom4j-1.6.1.jar
ehcache-1.2.3.jar
javassist-3.12.1.GA.jar
javassist-3.4.GA.jar
jta-1.0.1B.jar
log4j-1.2.14.jar
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar
tapestry5-annotations-5.2.6.jar
tapestry-core-5.2.6.jar
tapestry-func-5.2.6.jar
tapestry-ioc-5.2.6.jar
tapestry-json-5.2.6.jar
tapx-core-1.1-20110620.210912-27.jar
tapx-core-1.2-20110705.222421-4.jar
tapx-datefield-1.1-20110617.214353-17.jar
tapx-datefield-1.2-20110705.222544-4.jar
一切看起来都很正常,因为我试图用挂毯来继承hibernate继承。
父类代码
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pz850.entities;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
/**
*
* @author nikola
*/
@Entity
@Table(name = "GRUPA")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Grupa.findAll", query = "SELECT g FROM Grupa g"),
@NamedQuery(name = "Grupa.findByGrupaId", query = "SELECT g FROM Grupa g WHERE g.grupaId = :grupaId"),
@NamedQuery(name = "Grupa.findByGrupaNaziv", query = "SELECT g FROM Grupa g WHERE g.grupaNaziv = :grupaNaziv"),
@NamedQuery(name = "Grupa.findByGrupaBroj", query = "SELECT g FROM Grupa g WHERE g.grupaBroj = :grupaBroj")})
@Inheritance(strategy= InheritanceType.TABLE_PER_CLASS)
public class Grupa implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
@Basic(optional = false)
@Column(name = "GRUPA ID")
private Integer grupaId;
@Column(name = "GRUPA NAZIV")
private String grupaNaziv;
@Column(name = "GRUPA BROJ")
private Integer grupaBroj;
@ManyToOne(cascade = CascadeType.PERSIST)
@NotFound(action = NotFoundAction.IGNORE)
private Predmet predmet;
@OneToMany(cascade = CascadeType.PERSIST)
@NotFound(action = NotFoundAction.IGNORE)
private Collection<Student> student = new ArrayList<Student>();
public Grupa() {
}
public Grupa(Integer grupaId) {
this.grupaId = grupaId;
}
public Integer getGrupaId() {
return grupaId;
}
public void setGrupaId(Integer grupaId) {
this.grupaId = grupaId;
}
public String getGrupaNaziv() {
return grupaNaziv;
}
public void setGrupaNaziv(String grupaNaziv) {
this.grupaNaziv = grupaNaziv;
}
public Integer getGrupaBroj() {
return grupaBroj;
}
public void setGrupaBroj(Integer grupaBroj) {
this.grupaBroj = grupaBroj;
}
@Override
public int hashCode() {
int hash = 0;
hash += (grupaId != null ? grupaId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Grupa)) {
return false;
}
Grupa other = (Grupa) object;
if ((this.grupaId == null && other.grupaId != null) || (this.grupaId != null && !this.grupaId.equals(other.grupaId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "pz850.entities.Grupa[ grupaId=" + grupaId + " ]";
}
}
儿童班的代码
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pz850.entities;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import org.apache.tapestry5.annotations.Property;
/**
*
* @author nikola
*/
@Entity
public class InternetGrupa extends Grupa implements Serializable{
@Basic(optional = false)
@Column(name="VRSTA_STUDIRANJA")
@Property
private String vrstaStudija = "Internet";
public InternetGrupa() {
} public String getVrstaStudija() {
return vrstaStudija;
}
public void setVrstaStudija(String vrstaStudija) {
this.vrstaStudija = vrstaStudija;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final InternetGrupa other = (InternetGrupa) obj;
if ((this.vrstaStudija == null) ? (other.vrstaStudija != null) : !this.vrstaStudija.equals(other.vrstaStudija)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 53 * hash + (this.vrstaStudija != null ? this.vrstaStudija.hashCode() : 0);
return hash;
}
@Override
public String toString() {
return "Internet{" + "vrstaStudija=" + vrstaStudija + '}';
}
}
如果它是一个应删除的库? 你认为这是父子继承使得hibernate问题吗? 我想我已经正确完成了tutorial说
答案 0 :(得分:1)
正如@Henning暗示的那样,您的图书馆之间存在冲突。在这个特殊的情况下,它是一个tapestry-hibernate库,在hibernate库中没有它的真正支持(当前的tapestry-hibernate库不支持的版本),所以你应该去DOCJAR看看是什么您的特定tapestry-hibernate库需要真正的hibernate库(或者甚至是库,不知道有多少库依赖于tap-hibernate库)。
答案 1 :(得分:1)
Hibernate在类路径上两次,为3.5,并且通过hibernate-support作为一个非描述性的3.x(hibernate3.jar)(这是什么?)。修复类路径会有所帮助。