log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
org.hibernate.MappingException: Could not read mappings from resource: model/Comment.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
at util.CreateTable.<clinit>(CreateTable.java:12)
Caused by: org.hibernate.MappingException: Unable to determine entity name
at org.hibernate.cfg.HbmBinder.bindClass(HbmBinder.java:528)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:280)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153)
at org.hibernate.cfg.Configuration.add(Configuration.java:386)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
... 7 more
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:59)
at util.CreateTable.create(CreateTable.java:21)
at util.CreateTable.main(CreateTable.java:30)
package model;import java.io.Serializable;
import java.util.Date;public class Comment implements Serializable{ public Comment(String reviewer, double score, Date date, String content,
String productName) {
super();
this.reviewer = reviewer;
Score = score;
this.date = date;
this.content = content;
this.productName = productName;
} /**
 * 
 */
private static final long serialVersionUID = 1L;

private long id;
//评论标识
private String reviewer;
//评论者
private double Score;
//评分
private Date date;
//评论日期
private String content;
//评论内容
private String productName;
//被评论的商品名称

public Comment(){};


public String getReviewer() {
return reviewer;
}
public void setReviewer(String reviewer) {
this.reviewer = reviewer;
}
public double getScore() {
return Score;
}
public void setScore(double score) {
Score = score;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}

public void setProductName(String productName) {
this.productName = productName;
} public String getProductName() {
return productName;
}
public void setId(long id) {
this.id = id;
}
public long getId() {
return id;
}
public boolean equals(Object obj){
if(this == obj)
{
return true;
}
if(obj != null && obj.getClass() == Comment.class)
{
Comment comment = (Comment)obj;
return this.getReviewer().equals(comment.getReviewer());
}
return false;
}

public int hashCode(){
return Long.toString(id).hashCode();
}
}<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="model.Comment"> 
<class table="Comment">
<id name="id" type="java.lang.Long"  column="id">       
   <generator class="identity" />
</id>
<property  name="reviewer" column="reviewer" type="java.lang.String"  not-null="true"/>
<property  name="Score" column="Score" type="java.lang.Double"  not-null="true"/>
<property  name="date" column="date" type="java.util.Date"  not-null="true"/>
<property  name="content" column="content" type="java.lang.String"  not-null="true"/>
<property  name="productName" column="productName" type="java.lang.String"  not-null="true"/>

<many-to-one name="comment" column="comment" class="Product" not-null="true" /> 

</class>
</hibernate-mapping>