I am new to hibernate and am following the book.
Now I am working for a practice, to create receipts for sales, and I got the error like this:
Jan 05, 2015 5:40:17 PM org.hibernate.type.BasicTypeRegistry register
INFO: Type registration [materialized_blob] overrides previous : org.hibernate.type.MaterializedBlobType@270c127d
Jan 05, 2015 5:40:17 PM org.hibernate.type.BasicTypeRegistry register
INFO: Type registration [clob] overrides previous : org.hibernate.type.ClobType@991e092
Jan 05, 2015 5:40:17 PM org.hibernate.type.BasicTypeRegistry register
INFO: Type registration [java.sql.Clob] overrides previous : org.hibernate.type.ClobType@991e092
Jan 05, 2015 5:40:17 PM org.hibernate.type.BasicTypeRegistry register
INFO: Type registration [materialized_clob] overrides previous : org.hibernate.type.MaterializedClobType@482e9626
Jan 05, 2015 5:40:17 PM org.hibernate.type.BasicTypeRegistry register
INFO: Type registration [wrapper_characters_clob] overrides previous : org.hibernate.type.CharacterArrayClobType@6a83bdcf
Jan 05, 2015 5:40:17 PM org.hibernate.type.BasicTypeRegistry register
INFO: Type registration [wrapper_materialized_blob] overrides previous : org.hibernate.type.WrappedMaterializedBlobType@6f2297aa
Jan 05, 2015 5:40:17 PM org.hibernate.type.BasicTypeRegistry register
INFO: Type registration [characters_clob] overrides previous : org.hibernate.type.PrimitiveCharacterArrayClobType@481352e6
Jan 05, 2015 5:40:17 PM org.hibernate.type.BasicTypeRegistry register
INFO: Type registration [blob] overrides previous : org.hibernate.type.BlobType@6ca79f01
Jan 05, 2015 5:40:17 PM org.hibernate.type.BasicTypeRegistry register
INFO: Type registration [java.sql.Blob] overrides previous : org.hibernate.type.BlobType@6ca79f01
Failed to build the Factory object.org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
The hbm file is:
<hibernate-mapping>
<class name = "doubler.Customer" table = "CustomerDetails">
<meta attribute="class-description">
This class is about the detail of customer.
</meta>
<id name = "id" type = "int" column = "id">
<generator class="native"/>
</id>
<property name = "firstName" type = "string" column = "first_name"/>
<property name = "lastName" type = "string" column = "last_name"/>
<property name = "comment" type = "string" column = "comment"/>
<set name="orders" cascade = "all">
<key column = "customer_id"/>
<one-to-many class = "doubler.Order"/>
</set>
</class>
<class name = "doubler.Order" table = "CustomerOrder">
<meta attribute="class-description">
This class is about the order of customers.
</meta>
<id name = "id" type = "int" column = "id">
<generator class="native"/>
</id>
<set name="orderDetails" cascade = "all">
<key column = "order_id"/>
<one-to-many class = "doubler.OrderDetail"/>
</set>
</class>
<class name = "doubler.OrderDetail" table = "OrderDetails">
<meta attribute="class-description">
This class is about the details of orders.
</meta>
<id name = "id" type = "int" column = "id">
<generator class="native"/>
</id>
<property name = "quantity" type = "int" column = "quantity"/>
<property name = "productId" type = "int" column = "product_id"/>
<many-to-one name = "product" column = "product"
class = "doubler.Product" not-null = "true"/>
</class>
<class name = "doubler.Product" table = "ProductDetails">
<meta attribute="class-description">
This class is about the details of products.
</meta>
<id name = "id" type = "int" column = "id">
<generator class="native"/>
</id>
<property name = "name" type = "string" column = "name"/>
<property name = "price" type = "int" column = "price"/>
</class>
</hibernate-mapping>
The cfg.xml file is
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.connection.url">
jdbc:mysql://127.0.0.1:3307/CustomerProductsReceipt</property>
<property name="hibernate.connection.username">Robert</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping resource = "CustomerProductsReceipt.hbm.xml"/>
</session-factory>
</hibernate-configuration>
The classes are
public class Customer {
private int id;
private
String firstName;
private String lastName;
private String comment;
private Set orders;
(getters and setters)
}
public class Order {
private int id;
private int customerId;
private Set orderDetails;
(getters and setters)
}
public class OrderDetail {
private int id;
private int orderId;
private int productId;
private int quantity;
private Product product;
(getters and setters)
}
public class Product {
private int id;
private String name;
private int price;
(getters and setters)
}
And my jars are: hibernate3, commoms-collections-3.1, dom4j-1.6.1, slfj-api-1.7.7, mysql-connector-java-5.0.8-bin,slf4j-log4j12, log4j-1.2.15, cglib-2.1, javassist-3.18.0-ga
Any help in this regard shall be highly appreciated.
regards,
rahul