-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Annotations Alpha 3 to B1Preview - NoSuchMethodError
PostPosted: Wed Apr 20, 2005 1:23 pm 
Newbie

Joined: Wed Apr 20, 2005 12:58 pm
Posts: 8
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 20, 2005 10:52 pm 
Newbie

Joined: Wed Apr 20, 2005 12:58 pm
Posts: 8
If this is a problem with B1 Preview, pls. let me know so that I can revert back to Alpha3. Is Alpha3 better to work with for now?

Pls. let me know. This would be great help.

Regards,

Vinay


Top
 Profile  
 
 Post subject: Pls. help
PostPosted: Thu Apr 21, 2005 10:50 pm 
Newbie

Joined: Wed Apr 20, 2005 12:58 pm
Posts: 8
Hi All,

I was hoping for some response on this. Looks like I am alone on this one.

Does this mean that Annotations are still very new to be tried in a NEW real project? As my project is going to be in development for next 6 months, I was really hoping that I use annotations.

I would have ignored the problem had it been just one thing broken. I am just not able to proceed with Annotations B1 because of the above problem. Pls. note that Alpha 3 works just fine.

Any help or suggestions are highly appreciated.

Regards,

Vinay


Top
 Profile  
 
 Post subject: Tried it with 3.0.1
PostPosted: Fri Apr 22, 2005 8:01 am 
Newbie

Joined: Wed Apr 20, 2005 12:58 pm
Posts: 8
The stack trace says it all:

This is a show stopper ( at least for me).

How come it works for others? I wonder?

Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.mapping.Column.getScale()I
at org.hibernate.cfg.Ejb3JoinColumn.linkValueUsingDefaultColumnNaming(Ejb3JoinColumn.java:203)
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:96)
at org.hibernate.cfg.AnnotationBinder.bindFkSecondPass(AnnotationBinder.java:1265)
at org.hibernate.cfg.FkSecondPass.secondPass(FkSecondPass.java:36)
at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:31)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:163)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:586)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:59)
at org.hibernate.test.annotations.CreateSchema.main(CreateSchema.java:36)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 22, 2005 11:09 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Please use Hibernate Core 3.0.1

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.