困扰我3天的问题---建立新的用户记录出错
这个问题困扰我3天了 虽然知道错误是说我的生成新数据的时候数据库关键字语法错误,却不知道问题出在那里 在这里请大家帮帮忙
1 CMP生成了数据库 生成关键字的语句如下
/**
* @ejb.interface-method view-type = "both"
* @ejb.persistence column-name = "id"
* sql-type = "SERIAL"
* jdbc-type = "INTEGER"
* @ejb.pk-field
*
* @return
*/
我的数据库是mysql4.0 id字段在表里面的类型竟然是bigint 不知道这是为什么
2 下面3个函数分别是在(1)UserInfo.java (2)UserInfoHome.java (3)UserInfoLocalHome.java里面的create()方法
(1) public Integer ejbCreate() throws CreateException {
return null;
}
(2) public com.luojie.userinfo.entity.interfaces.UserInfo create()
throws javax.ejb.CreateException,java.rmi.RemoteException;
(3) public com.luojie.userinfo.entity.interfaces.UserInfoLocal create()
throws javax.ejb.CreateException;
3 此函数是我的sessionbean里面创建新记录 如下:
/**
* This methode create a new userinfo
*
* @ejb.interface-method view-type = "both"
*/
public void createNewUserInfo(String userName)throws EJBException, CreateException{
try{
InitialContext context = new InitialContext();
// Get the home interface with JNDI from the application server
UserInfoLocalHome userInfoLocalHome = (UserInfoLocalHome)context.lookup
(UserInfoLocalHome.JNDI_NAME);
UserInfoLocal userInfoLocal = userInfoLocalHome.create();
//userInfoLocal.setId(new Integer(0));
userInfoLocal.setUserName(userName);
}catch (NamingException e) {
System.out.println("this is createNewUserInfo's error "+ e.getMessage());
throw new EJBException(e.getMessage());
}
}
4 部署成功 生成webservice 在webservice有看到了createNewUserInfo方法 利用http://localhost:8080/axis/services/UserInfoSession?method=createNewUserInfo&username=ss
页面出现如下错误
org.jboss.tm.JBossTransactionRolledbackException: Error extracting generated keys; CausedByException is:
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 '('userinfo_id_seq')' at line 1; CausedByException is:
Error extracting generated keys; CausedByException is:
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 '('userinfo_id_seq')' at line 1; nested exception is:
javax.ejb.EJBException: Error extracting generated keys; CausedByException is:
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 '('userinfo_id_seq')' at line 1; - nested throwable: (javax.ejb.EJBException: Error extracting generated keys; CausedByException is:
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 '('userinfo_id_seq')' at line 1)
麻烦大家帮帮我 谢谢