7 Replies Latest reply: May 22, 2012 8:05 AM by Halli Balli RSS

Tablename with reserved name "user" -> "XUser"

Halli Balli Newbie

Hallo,

 

when I deploy my entity beans I get the following error:

 

10:05:45,817 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.subunit."gan

.ear"."gan_ejb-server.jar".component.UserEntityEJB.jdbc.store-manager.START: org.jboss.msc.service.StartException in service jboss.dep

loyment.subunit."gan.ear"."gan_ejb-server.jar".component.UserEntityEJB.jdbc.store-manager.START: JBAS010785: Failed start store mana

ger

        at org.jboss.as.cmp.jdbc.JdbcStoreManagerStartService.start(JdbcStoreManagerStartService.java:46)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2

.GA]

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_31]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_31]

        at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_31]

Caused by: java.lang.RuntimeException: JBAS010765: Error while creating table: Xuser

        at org.jboss.as.cmp.jdbc.JDBCStartCommand.createTable(JDBCStartCommand.java:447)

        at org.jboss.as.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:175)

        at org.jboss.as.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:233)

        at org.jboss.as.cmp.jdbc.JdbcStoreManagerStartService.start(JdbcStoreManagerStartService.java:44)

        ... 5 more

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Eine Tabelle kann h÷chstens eine timestamp-Spalte besitzen. Da die 'Xuser'-Tabel

le bereits eine timestamp-Spalte besitzt, kann die 'valid_until'-Spalte nicht hinzugef³gt werden.

        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)

        at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)

        at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(Unknown Source)

        at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(Unknown Source)

        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)

        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)

        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)

        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)

        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeUpdate(Unknown Source)

        at org.jboss.jca.adapters.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:371)

        at org.jboss.as.cmp.jdbc.JDBCStartCommand.createTable(JDBCStartCommand.java:439)

        ... 8 more

 

 

I think the problem is caused because in the database there is a table called user and this is a reserved word. And JBoss seems to use Xuser instead

Is there a way to "convince" JBoss to accept user as a tablename for my entity bean? Escaping brackets [] don't work either.

 

In addition to that I am wondering why there is a error about timestamp columns because I don't use MySQL I use MS-SQL and there the column's data type is Datetime not Timestamp.

 

Any help is apreciated

Thank you in advance

  • 1. Re: Tablename with reserved name "user" -> "XUser"
    Halli Balli Newbie

    Can anybody tell me where I can define the type-mapping for MS-SQL?

     

    Maybe then the brackets would work as well?

    I have to find a way to use the tablename as it is --> user

     

    In older version of JBoss I could use brackets to escape the tablename like [user]

     

    Is this still somehow possible?

  • 2. Re: Tablename with reserved name "user" -> "XUser"
    Halli Balli Newbie

    Or can aynone tell me if I can remove the word user from the reserved-word list?

    In older version of JBOSS there was a list in standardjbosscmp-jdbc.xml

    By the way where has this file gone to? There was also the definition of the type mapping.

  • 3. Re: Tablename with reserved name "user" -> "XUser"
    jaikiran pai Master

    Halli Balli wrote:

     

    Can anybody tell me where I can define the type-mapping for MS-SQL?

     

    You can use the jbosscmp-jdbc.xml in your EJB jar's META-INF folder to include this:

     

    <jbosscmp-jdbc> 
        <defaults> 
            ...
            <datasource-mapping>MS SQLSERVER</datasource-mapping>
       </defaults>
    </jbosscmp-jdbc>
    

     

    There's also a MS SQLSERVER2000 if you want that one.

  • 4. Re: Tablename with reserved name "user" -> "XUser"
    jaikiran pai Master

    Halli Balli wrote:

     

     

    In older version of JBOSS there was a list in standardjbosscmp-jdbc.xml

    By the way where has this file gone to? There was also the definition of the type mapping.

    It's there in JBOSS_HOME/modules/org/jboss/as/cmp/main/jboss-as-cmp-7.1.1.Final.jar

  • 5. Re: Tablename with reserved name "user" -> "XUser"
    Halli Balli Newbie

    Great, this helped a lot. The file also explained my other error with the ExampleDS because in the standardjbosscmp-jdbc.xml this is defined as the default datasource.

    Also there is Hypersonic as default type mapping.

     

    I first changed the default datasource and then the type-mapping to MS SQLServer2000. Now it is working fine.

    I also set <create-table>false</create-table>

     

    Even the brackets seem to work now. But maybe this is just because the create table call is not called any more.

     

     

    I wonder why the standardjbosscmp-jdbc.xml was put into the jar file. This is not user friendly (in my opinion)

    Of course you showed me that I can set the default datasource and type-mapping in each jbosscmp-jdbc.xml file in my jar files

    But what about the other parameters like <create-table> ?

     

    Thank you very much

  • 6. Re: Tablename with reserved name "user" -> "XUser"
    jaikiran pai Master

    Halli Balli wrote:

     

    I wonder why the standardjbosscmp-jdbc.xml was put into the jar file. This is not user friendly (in my opinion)

    That file isn't supposed to be changed by users, AFAIK.

     

     

    Halli Balli wrote:

     

    Of course you showed me that I can set the default datasource and type-mapping in each jbosscmp-jdbc.xml file in my jar files

    But what about the other parameters like <create-table> ?

     

     

    You can set the <create-table> element in your application's jbosscmp-jdbc.xml.

  • 7. Re: Tablename with reserved name "user" -> "XUser"
    Halli Balli Newbie

    Ah ok, than I changed the wrong file.

    Thank you once again