2

I am porting my database from MySQL to SQLServer. I am having problem when during startup the tables are created and i get syntax error. As below

SEVERE: Unsuccessful: create table ANSWER (AID bigint not null auto_increment, ANS varchar(255), NUMBER integer, QID bigint, primary key (AID)) type=InnoDB Jan 12, 2011 1:25:28 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute SEVERE: Incorrect syntax near 'auto_increment'.

I tried to run the above SQL directly in MsSQLServer and got the syntax error regarding auto increment.

The code used to work perfectly fine in MYSql.

@Entity 
@Table(name = "ANSWER") 
public class Answer implements Identifiable<Long>, Serializable, Comparable<Answer> {

    @Id
    @Column(name = "AID")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

Thank you.

1 Answer 1

3

Make sure you correctly changed the SQL dialect in Hibernate configuration.

Sign up to request clarification or add additional context in comments.

1 Comment

I just logged in to say that i took a break and with fresh mind i found that i had not changed dialect. Spot on axtavt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.