困扰我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)
麻烦大家帮帮我 谢谢
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)
麻烦大家帮帮我 谢谢
...全文
相关推荐
班级心理问题排查记录表.docx
班级心理问题排查记录表.docx"是学校心理健康教育工作中的一个重要工具,用于系统地识别、记录和管理学生可能存在的心理困扰,以便及时进行干预和支持。首先,我们需要理解表格的构成部分:1.
python logging重复记录日志问题的解决方法
当遇到重复记录日志的问题时,可能会对调试和问题跟踪造成困扰。本文将深入探讨python logging
清空金万维天联高级版管理员帐号
同时,为了预防此类问题,平时应定期备份关键数据,并建立有效的账号管理策略,例如定期更换密码、记录重要信息等。
CSS网页布局困扰新手的问题
边界重合是另一个常见问题。在调整元素间距时,使用padding或border而不是margin可以避免边界计算上的困扰。
解决idea导入项目出错,打包没有依赖问题.docx
对于开发人员来说,掌握这些技巧是非常有帮助的,可以提高工作效率,减少因环境差异带来的困扰。总之,解决IDEA导入项目出错及依赖问题的关键在于正确配置IDEA环境、合理管理项目依赖以及正确使用构建工具。


