Hi All,
I was running the Annotations Alpha 3 just fine. Then I noticed B1 preview and decided to migrate to it. I did replace the ejb-3.0-edr2.jar and hibernate-annotations.jar
The problem is with scale:
public class Discount implements Serializable {
private Long id;
private double discount;
private Customer owner;
@Column(precision=5, scale=2)
public double getDiscount() {
return discount;
}
I get:
java.lang.NoSuchMethodError: org.hibernate.mapping.Column.setScale()(I)V
at ac.addAnnotatedClass(Discount.class);
When I change the double to say "String", I then get the execption on:
SchemaExport schemaExport = new SchemaExport(ac, props);
I was NOT experiencing any problems with Alpha 3
Hibernate version:
V3.0 & Annotations 3B1 Preview
Mapping documents:
Discount.class which is part of the test package
Code between sessionFactory.openSession() and session.close():
public static void main(String[] args) {
AnnotationConfiguration ac = new AnnotationConfiguration();
ac.setProperty(Environment.HBM2DDL_AUTO, "create-drop");
ac.addAnnotatedClass(Customer.class);
ac.addAnnotatedClass(Discount.class);
ac.addAnnotatedClass(Ticket.class);
ac.addAnnotatedClass(Passport.class);
ac.addPackage("org.hibernate.test.annotations");
Properties props = new Properties();
props.setProperty(Environment.USER, "root");
props.setProperty(Environment.PASS, "password");
props.setProperty(Environment.DIALECT, MySQLDialect.class.getName());
props.setProperty(Environment.URL, "jdbc:mysql://Vin:3306/FA");
props.setProperty(Environment.DRIVER, com.mysql.jdbc.Driver.class
.getName());
props.setProperty(Environment.SHOW_SQL, "true");
SchemaExport schemaExport = new SchemaExport(ac, props);
schemaExport.setOutputFile("c:/xddl.txt");
schemaExport.create(false, true);
}
Full stack trace of any exception that occurs:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.mapping.Column.setScale(I)V
at org.hibernate.cfg.Ejb3Column.initMappingColumn(Ejb3Column.java:65)
at org.hibernate.cfg.Ejb3Column.<init>(Ejb3Column.java:50)
at org.hibernate.cfg.Ejb3Column.buildColumnFromAnnotation(Ejb3Column.java:215)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:618)
at org.hibernate.cfg.AnnotationBinder.processElementsOfAClass(AnnotationBinder.java:573)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:436)
at org.hibernate.cfg.AnnotationConfiguration.addAnnotatedClass(AnnotationConfiguration.java:94)
at org.hibernate.test.annotations.CreateSchema.main(CreateSchema.java:21)
Name and version of the database you are using:
MySql 4.05
The generated SQL (show_sql=true):
None
Debug level Hibernate log excerpt:
None
|