-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problems with seam entity
PostPosted: Wed Feb 24, 2010 4:18 am 
Newbie

Joined: Wed Feb 24, 2010 4:13 am
Posts: 2
My work environment is:

eclipse: eclipse-jee-galileo-sr1
Application Server: jboss-5.1.0.GA
Seam: jboss-seam-2.2.0.GA
DB Server: mysql-5.1.44
OS: windows 7

I have created a seam project by selected File->New->Seam Web Project
Then I wanted to test whether this project can work properly. I create a seam entity named "User",just like here

Code:
package org.domain.bookstore.entity;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.Version;
import org.hibernate.validator.Length;

@Entity
public class User implements Serializable
{
    // seam-gen attributes (you should probably edit these)
    private Long id;
    private Integer version;
    private String name;

    // add additional entity attributes

    // seam-gen attribute getters/setters with annotations (you probably should edit)

    @Id @GeneratedValue
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Version
    public Integer getVersion() {
        return version;
    }

    private void setVersion(Integer version) {
        this.version = version;
    }

    @Length(max = 20)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}   
Then I ran the server,but an error occured.

Code:
15:24:48,454 ERROR [SchemaExport] Unsuccessful: create table User (id bigint generated by default as identity (start with 1), name varchar(20), version integer, primary key (id))
15:24:48,454 ERROR [SchemaExport] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'generated by default as identity (start with 1), name varchar(20), version integ' at line 1


I googled it , from the answers I thought it was caused by the @GeneratedValue annotation so I removed it. Luckly it worked and the table "user" generated. But I still want use the @GeneratedValue annotation for generating the id.

I hope to get help from here~~.


Top
 Profile  
 
 Post subject: Re: Problems with seam entity
PostPosted: Mon Mar 01, 2010 5:56 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Please check if you specified the correct dialect in configuration.


Top
 Profile  
 
 Post subject: Re: Problems with seam entity
PostPosted: Tue Mar 02, 2010 9:29 pm 
Newbie

Joined: Wed Feb 24, 2010 4:13 am
Posts: 2
Yes that is the problems, may be the dialect can't be changed automatically.
Thank you.


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