-->
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.  [ 4 posts ] 
Author Message
 Post subject: Annotations B1 Prev broken?
PostPosted: Fri Apr 22, 2005 8:51 am 
Newbie

Joined: Wed Apr 20, 2005 12:58 pm
Posts: 8
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0.1

Annotations B1 Preview

Mapping documents:
N/A

Code between sessionFactory.openSession() and session.close():

package org.hibernate.test.annotations;

import java.util.Properties;

import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.tool.hbm2ddl.SchemaExport;

public class CreateSchema {

/**
* @param args
*/

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:

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)


Name and version of the database you are using:

MySql 4.0.5

The generated SQL (show_sql=true):
N/A
Debug level Hibernate log excerpt:
N/A


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 22, 2005 8:54 am 
Newbie

Joined: Wed Apr 20, 2005 12:58 pm
Posts: 8
I should mention that the class Ticket is a part of the test cases that are a part of the preview.

package org.hibernate.test.annotations;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.JoinColumn;
import javax.persistence.CascadeType;
import javax.persistence.GeneratorType;
import javax.persistence.Column;
import java.io.Serializable;

/**
* Flight ticket
* @author Emmanuel Bernard
*/
@Entity
public class Ticket implements Serializable {
Long id;
String number;

public Ticket() {
}

@Id(generate = GeneratorType.AUTO)
public Long getId() {
return id;
}

@Column(name="ticket_number")
public String getNumber() {
return number;
}

public void setId(Long long1) {
id = long1;
}

public void setNumber(String string) {
number = string;
}

public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Ticket)) return false;

final Ticket ticket = (Ticket) o;

if (!number.equals(ticket.number)) return false;

return true;
}

public int hashCode() {
return number.hashCode();
}

}


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

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
My guess is that you have a wrong Hibernate version in your classpath

_________________
Emmanuel


Top
 Profile  
 
 Post subject: You are right
PostPosted: Sat Apr 23, 2005 7:10 am 
Newbie

Joined: Wed Apr 20, 2005 12:58 pm
Posts: 8
It is unbelievable. But you are right. I thought I have consciously moved from Hibernate 3.0 to 3.0.1

But it seems I missed the step.


Thanks for your help.

Vinay


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.