Bug in auto-increment for MSSQL

I am using kodo 3.1.0 and have a scenario where I am persisting a new object
that uses an auto-increment PK and the database has an on-insert trigger
that inserts a log into an audit table.
At the database level, what is happing is:
1) kodo calls "insert into t_timeentry (........)
2) the database calls "insert into t_timeentrylog (......)
3) kodo calls @@IDENTITY to get the ID to associate with the new timeentry.
The problem is, @@IDENTITY is getting back the last identity used,
regardless of table, so it is returning the id inserted into t_timeentrylog
and kodo thinks that's the id of the timeentry. In the end, I get a
optimistic lock exception when I try to update the new timeentry because it
is trying to update based on the id of the timeentrylog.
What you need to do is call SCOPE_IDENTITY or IDENT_CURRENT rather than
@@IDENTITY when you get auto-incremented columns. Unfortunately, those
functions only exist in SQL 2000 (maybe 7), so people with SQL6.5 (and maybe
7) are just out luck if they have triggers on inserts.
Is there a work-around for this? It's causing problems throughout my
system.
Nathan

If the query string you want executed to get the last auto-inc value
does not rely on context, you can set it easily with:
kodo.jdbc.DBDictionary: LastGeneratedKeyQuery="<sql>"
If it is more complex, then you'll need to extend
kodo.jdbc.sql.SQLServerDictionary and override the following method:
public long getGeneratedKey (kodo.jdbc.schema.Column col,
Connection conn)
throws SQLException
// if you need the col or table name:
String colName = col.getName ();
String tableName = col.getTable ().getName ();
// execute the necessary SQL to return the last inserted value...
Then you can plug your dictionary into Kodo with:
kodo.jdbc.DBDictionary: your.custom.Dictionary

Similar Messages

  • Auto increment for file names

    Does anybody know if it is possible to have the 'Open/Create/Replace.vi to search for exsisting files with a specific pattern, like data001.txt, and automatically increment the name so a new file is created called data002.txt
    Thanks
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

    Thanks to both, between the two it looks like I'll be able to do what I want.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • Auto Increment for BP code in BP master

    Dear All,
    CAn any one provide FMS for autoincrement of BP as per following manner...
    For Customer : Code must start with C followed by the customer first alphabet and then "000" +1
    for eg the code must be : CA0001, CA0002, CB0001....and so on
    Similarly for Vendor it must be VA0001, VB0001.....
    So when user enters the first alphabet the consecutive increment number must be displayed.
    s.r.p.

    To generate the card code try this FS:
    If $[OCRD.CardType]='C'
    Select 'C'+substring($[$7.1],1,1)
             +substring(str(max(Substring(CardCode,3,4))+10001,5),2,4)
       From OCRD
       Where CardCode like 'C'+substring($[$7.1],1,1)+'%'
    (But the code will be generated after filling the partner  name.)

  • Auto increment for order numbers

    I am not sure on how to approach this and if its a backend or
    frontend issue (PHP/MySQL).
    Generally when you order something online the site will give
    you an order number that is naturally unique from other orders. I
    have the order_id field which is a primary key and auto_increments
    starting at "1". Is there a way to make it start at a higher number
    like 100000 or would that be a bad idea? Basically, I don't want
    the user to know they are order #1.
    Or would it be more wise (or even possible) to make another
    field that auto_increments starting at the higher number and leave
    the original order_id starting at 1? If that's the case, how would
    I do that? Is it controlled by PHP or MySQL?

    Those order numbers are usually segmented. For instance, some
    of it is
    based on the order date, some of it on your customer ID, some
    of it serial,
    or perhaps many other things, even your ZIP code or the
    dollar amount. You
    could construct that number at either end once you decide how
    you want it
    done.
    "Eiolon" <[email protected]> wrote in
    message
    news:ec2jgf$2hq$[email protected]..
    >I am not sure on how to approach this and if its a
    backend or frontend
    >issue
    > (PHP/MySQL).
    >
    > Generally when you order something online the site will
    give you an order
    > number that is naturally unique from other orders. I
    have the order_id
    > field
    > which is a primary key and auto_increments starting at
    "1". Is there a
    > way to
    > make it start at a higher number like 100000 or would
    that be a bad idea?
    > Basically, I don't want the user to know they are order
    #1.
    >
    > Or would it be more wise (or even possible) to make
    another field that
    > auto_increments starting at the higher number and leave
    the original
    > order_id
    > starting at 1? If that's the case, how would I do that?
    Is it controlled
    > by
    > PHP or MySQL?
    >

  • Auto increment variable in foreach loop in ssis

    i know this has been asked N number of times, but still i have a question for you guys
    i have files sitting in FTP location
    i am loading the data from the files into tables (no issues)
    but i need to assign value to a particular column as -99999999 and then auto increment that number while loading the files into the database
    I cannot have auto increment for the that particular column
    should i use a derived column, script component, execute sql task?
    can somebody point me to the right direction
    if it were a single file, assigning the auto incremental number is easy, but with for each loop, i am not able to get the solution
    Thanks

    Hi Jack,
    To achieve your goal, you can use a Row Count Transformation in the Data Flow Task to get row count for each file, and then use an Execute SQL Task after the Data Flow Task to update the total row count variable. Supposing the variable used in the Row Count
    Transformation is InsertCount, the variable used to store the total row count is TotalInsertCount. We need to set the ResultSet of the Execute SQL Task to “Single row”, and the SQLStatement to:
    DECLARE @Insert_Count INT, @Total_Insert_Count INT
    SET @Insert_Count=?
    SET @Total_Insert_Count=?
    SET @Total_Insert_Count=@Total_Insert_Count + @Insert_Count
    SELECT R_Total_Insert_Count=@Total_Insert_Count
    Then, set the Parameter Mapping of the Execute SQL Task, we map variable InsertCount and TotalInsertCount to the parameters in the SQL statement respectively. In the ResultSet page of the Execute SQL Task, map the resultset to variable TotalInsertCount.
    Please refer to the following screenshot:
    Regards,
    Mike Yin
    TechNet Community Support

  • Auto increment pseudo column

    Hi,
    If I have a sql statement like "select e.name from employees e", how can i add a pesudo column which is auto incremented for each row fetched? So something like
    incr_column name
    1 Jack
    2 Michael
    3 Freud
    Thank you

    how can i add a pesudo column which is auto incremented for each row fetched?
    Using ROWNUM Pseudocolumn :
    SELECT   ROWNUM, ename FROM emp;
    Using LEVEL Pseudocolumn :
    select sysdate+1 from dual connect by level <=30
    USing SEQUENCE Pseudocolumn :
    CREATE SEQUENCE emp_seq
       START WITH 1
       INCREMENT BY 1
       MINVALUE 1
       MAXVALUE 2000
       NOCACHE
       NOCYCLE;
    CREATE TABLE emp1 (empno number , ename VARCHAR2 (30), sal  NUMBER);
    INSERT INTO emp1
      VALUES   (emp_seq.NEXTVAL,'BEN', 5000);
    INSERT INTO emp1
      VALUES   (emp_seq.NEXTVAL,'DVEN', 5000);
    INSERT INTO emp1
      VALUES   (emp_seq.NEXTVAL,'EVA', 5000);
    SELECT   * FROM emp1;
    commit;
    SELECT   * FROM emp1;

  • How to use auto-increment and search option for MS Access DB

    Dear All,
               I have configured our invoice in Adobe Livecycle and connected it to MS Acess 2007 as per http://forms.stefcameron.com/2006/09/18/connecting-a-form-to-a-database/.
    All is working fine, I can insert, retrieve data from DB to invoice and vice versa.
    Now I want few things to be implemented on our invoice.
    When ever I open our invoice, it populate the first entry from DB, Is it possible to populate the last entry ?
    Auto increment invoice number from MS Access DB every time we open our invoice after save.
    How to implement search option from DB for invoice number ?
    Please let me know if someone can provide me help on my scenario, so that I can share more stuff related to invoice and DB.
    Look forward to hearing soon from experts and other team members.
    Thanks & Regards
    Riyad...

    As far as I know there is not any auto increment data type in Oracle. Instead of this you should create a sequence and get the next value of the sequence while creating a row in your table.
    CREATE SEQUENCE Test_Sequence ;
    CREATE TABLE Test_Table ( Id NUMBER , Foo VARCHAR2(4) ) ;
    ALTER TABLE Test_Table ADD CONSTRAINT Test_Table_PK_Id PRIMARY KEY ( Id ) ;
    INSERT INTO Test_Table ( Id , Information ) VALUES ( Test_Sequence.NEXTVAL , 'FOO' ) ;

  • Utilizing auto-increment/identity fields for primary key with "application" identity

    Is it possible to utilise an auto-increment (identity in MS SQL Server)
    field for the primary key field when using "application" identity?

    To the best of my knowledge, you cannot use auto-increment. Due to the
    differences in the way that identities are generated at the datastore
    (upon insert) vs. JDO (upon makePersistent), this feature of SQLServer is
    not supported yet.
    However, we do provide a variety of other ways of generating identity
    which may provide a closer fit to what you want, and
    our users may have some experience in solving your problem.
    On Tue, 28 Jan 2003 09:56:08 +0000, Sean Ryan wrote:
    Is it possible to utilise an auto-increment (identity in MS SQL Server)
    field for the primary key field when using "application" identity?--
    Stephen Kim
    [email protected]
    SolarMetric, Inc.
    http://www.solarmetric.com

  • Auto increment liveevent streamname folder/directory for each publish while same streamid string?

    Is it possible to auto increment a streamname when publishing to FMS?
    Instead of appending to the same folder/directory of the liveevent and stream files when publishing and unpublishing, is there an option to which if a stream is unpublished and republished to starts a new folder/directory _1, _2, _3, etc?
    Or even better, to name the folder with a timestamp of the publish? instead of _1, _2, _3 -- _2012oct8-2101, _2012oct9-0644, _2012oct10-1833
    Thanks.

    Hi,
    I think we should be able to do this.
    First - Do not specify any query string in your publish string. Just say 'livestream'. This means you are not assigning any event name.
    In the livepkgr main.asc, check out the function application.onPublish. When no event name is defined, the application uses the stream name itself as the event name. The code in livepkgr main.asc corresponding to this;
    if (queryString == undefined || (queryString.localeCompare("") == 0)) {
            /* Did not find query string so use the streamname as the event id */
            trace("Query string not specified. Using StreamName["
                  +streamObj.name+"] as eventname");
    Now, to accomplish your task, all you need to do is append some marker to this stream name.
    Essentially here:
    var liveEventName = streamObj.name
    I will leave it to you to make use of timestamps, shared objects etc. to keep track of the event name and incerement it for every publish attempt.
    As as example, if you do something like this:
    var liveEventName = streamObj.name + "Test"
    Your event name will be livestreamTest
    I hope this helps in some way.
    Thanks,
    Shiven

  • Can we specify prefix for an auto increment column

    Hi all,
    I want to create an auto increment column in oracle using oracle sequences.
    But i want to specify a prefix for the value appearing after increment.
    Prefix will remain constant.
    If we can how can i do that.
    And one more thing is i will call the sequence using a trigger only for a specified condition.My doubt here is can i allow nulls for auto incrementing column
    With Regards

    <s></s>
    -- Samples.
    create table tab1
    (id   varchar2(6) constraint p_tab1 primary key
    ,data varchar2(255)
    create sequence seq_tab1;
    create or replace
    trigger trg_tab1
    before insert on tab1
    for each row
    declare
      p_prefix varchar2(2) := 'AA';
    begin
      if (:new.id is null) then
        select p_prefix||to_char(seq_tab1.nextval,'fm0009') into :new.id from dual;
      end if;
    end
    -- Test
    SQL> insert into tab1(data) values('abc');
    1 row created.
    SQL> insert into tab1(id,data) values('BB9999','xyz');
    1 row created.
    SQL> select * from tab1;
    ID
    DATA
    AA0001
    abc
    BB9999
    xyz

  • MsSQL Auto increment Alphanumeric IT001, IT002

    Howt to Auto increment Alphanumeric ID Eg : IT001, IT002  in MSSQL

    Thank You Olaf Helper, It worked....
    see
    http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Auto-Increment ID for the Sharepoint 2010 List

    Hi,
    I have a requirement to have a SharePoint List with set of fields. One of the field should store the Custom ID field Ex: "2015-001". Numbers should auto increment the values i.e 011, 002 and so on.
    Can someone help me to achieve this requirement via Out-of-box.
    I tried using [ID] field and tried concatenating to bring up the value as "2015-001" but it didn't work and I read that [ID] field does not work as expected with the calculated column.
    I am aware there SP Designer workflow solution, JavaScript solution, List Adding Event Receiver solutions are available. I trying to find if there is any out-of-Box solution available.
    Share your thoughts/suggestion on this requirement

    Thanks Alex.
    We have used Infopath and we were able to achieve the Auto Increment requirement.
    There is another requirement:
    Created By and Created should be stamped together in the list. Ex: Field Name: Audit Trails - XXX,03/06/16/15, 05:08PM.
    I tried creating a field and used formula to concatenate Created By and Created field...but, When I Submit the form in Sharepoint List, Audit Trail Field is empty.
    I tried Submit/Receive data etc..but no luck
    Any Suggestions or thoughts?

  • Create Auto increment sequence number for list view report

    Hi All,
              Am using BAM 11.1.1.6 version, Have updating list report & wants to create auto increment sequence number at report level. Is it possible to create column at run time in BAM reports.
    Please help.
    Thanks.

    Hi All,
              Am using BAM 11.1.1.6 version, Have updating list report & wants to create auto increment sequence number at report level. Is it possible to create column at run time in BAM reports.
    Please help.
    Thanks.

  • Integer auto-increment fields

    I am using 3.0.3 and have a PC class that uses application identity and
    MSSQL server, so we are using auto-increment fields for our primary keys.
    In the past (with sequence-generated ids) we have used Integers for our
    mapped attributes, but with the application identity, it seems we need to
    use ints. Is there a reason for this, or is it a bug?
    Nathan

    Great. Thanks for the help.
    Nathan
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Nathan-
    This is a bug. I've reported it at:
    http://bugzilla.solarmetric.com/show_bug.cgi?id=910
    I expect it will be fixed in the next release. In the meantime, if you
    want to use a numeric wrapper for your auto-increment field, it will
    need to be of type java.lang.Long.
    In article <[email protected]>, Nathan Voxland wrote:
    It does work with Longs. I could switch my code to use Longs, although
    I
    don't always need that large of an id field.
    Nathan
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Nathan-
    If you change them both from Integer to a Long field, then does it
    work?
    >>>
    >>>
    In article <[email protected]>, Nathan Voxland wrote:
    Here is the code for the class and the ApplicationId class. The
    ApplicationId class was generated using the appidtool.
    public class Portfolio {
    private Integer id;
    private String name;
    private String notes;
    private Organization client;
    private Portfolio parentPortfolio;
    private Set subPortfolios;
    private Set projects;
    private Date created;
    private Person createdBy;
    private Date lastModified;
    private Person lastModifiedBy;
    public Portfolio(PersistenceManager pm) {
    pm.makePersistent(this);
    this.subPortfolios = new HashSet();
    this.projects = new HashSet();
    this.created = new Date();
    this.createdBy = new PersonPeer(pm).findLoggedIn();
    this.lastModified = this.created;
    this.lastModifiedBy = this.createdBy;
    public Integer getId() {
    return new id;
    public String getName() {
    return name;
    public void setName(String name) {
    this.name = name;
    public void jdoPostLoad() {
    public void jdoPreStore() {
    if (!((PersistenceCapable) this).jdoIsNew()) {
    this.lastModified = new Date();
    this.lastModifiedBy = new
    PersonPeer(((PersistenceCapable)
    this).jdoGetPersistenceManager()).findLoggedIn();
    public void jdoPreClear() {
    public void jdoPreDelete() {
    * Auto-generated by:
    * kodo.enhance.ApplicationIdTool
    public class PortfolioId
    implements Serializable
    static
    // register persistent class in JVM
    Class c = Portfolio.class;
    public Integer id;
    public PortfolioId ()
    public PortfolioId (String fromString)
    if ("null".equals (fromString))
    id = null;
    else
    id = new Integer (fromString);
    public String toString ()
    return String.valueOf (id);
    public int hashCode ()
    return ((id == null) ? 0 : id.hashCode ());
    public boolean equals (Object obj)
    if (this == obj)
    return true;
    if (!(obj instanceof PortfolioId))
    return false;
    PortfolioId other = (PortfolioId) obj;
    return ((id == null && other.id == null)
    || (id != null && id.equals (other.id)));
    Nathan
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Nathan-
    Is the primary key field an Integer in both the application
    identity
    class and the persistent class itself? They need to both be the same
    class.
    If they are the same, and you are still getting the exception, could
    you post the code for the classes (or else mail them to
    [email protected])?
    In article <[email protected]>, Nathan Voxland
    wrote:
    When I have my object use an int id, my test runs fine, when Iswitch
    to
    an
    Integer, I get the exception:
    kodo.util.FatalException: java.lang.ClassCastException
    NestedThrowables:
    java.lang.ClassCastException
    at
    kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:563)
    at
    com.correlat.intranet.projectmanagement.PortfolioTest.testFlush(PortfolioTes
    t.java:393)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(UnknownSource)
    at
    com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(Unknown
    Source)
    at
    com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(Unknown
    Source)
    at com.intellij.rt.execution.junit2.JUnitStarter.main(UnknownSource)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    at com.intellij.rt.execution.application.AppMain.main(UnknownSource)
    Caused by: java.lang.ClassCastException
    at
    com.correlat.intranet.projectmanagement.Portfolio.jdoReplaceField(Portfolio.
    java)
    atkodo.runtime.StateManagerImpl.replaceField(StateManagerImpl.java:2771)
    at
    kodo.runtime.StateManagerImpl.storeObjectField(StateManagerImpl.java:2272)
    atkodo.runtime.StateManagerImpl.storeObject(StateManagerImpl.java:2252)
    at
    kodo.jdbc.meta.ValueFieldMapping.setAutoIncrementValue(ValueFieldMapping.jav
    a:346)
    atkodo.jdbc.meta.ClassMapping.setAutoIncrementValue(ClassMapping.java:381)
    at
    kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.ja
    va:137)
    atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:357)
    atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:153)
    at
    kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:72)
    atkodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:507)
    at
    kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:158)
    at
    kodo.datacache.DataCacheStoreManager.flush(DataCacheStoreManager.java:412)
    at
    kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.jav
    a:794)
    at
    kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:550)
    ... 24 more
    NestedThrowablesStackTrace:
    java.lang.ClassCastException
    at
    com.correlat.intranet.projectmanagement.Portfolio.jdoReplaceField(Portfolio.
    java)
    atkodo.runtime.StateManagerImpl.replaceField(StateManagerImpl.java:2771)
    at
    kodo.runtime.StateManagerImpl.storeObjectField(StateManagerImpl.java:2272)
    atkodo.runtime.StateManagerImpl.storeObject(StateManagerImpl.java:2252)
    at
    kodo.jdbc.meta.ValueFieldMapping.setAutoIncrementValue(ValueFieldMapping.jav
    a:346)
    atkodo.jdbc.meta.ClassMapping.setAutoIncrementValue(ClassMapping.java:381)
    at
    kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.ja
    va:137)
    atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:357)
    atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:153)
    at
    kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:72)
    atkodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:507)
    at
    kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:158)
    at
    kodo.datacache.DataCacheStoreManager.flush(DataCacheStoreManager.java:412)
    at
    kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.jav
    a:794)
    at
    kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:550)
    at
    com.correlat.intranet.projectmanagement.PortfolioTest.testFlush(PortfolioTes
    t.java:393)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    at com.intellij.rt.execution.junit2.JUnitStarter.main(UnknownSource)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    at com.intellij.rt.execution.application.AppMain.main(UnknownSource)
    Nathan
    "Patrick Linskey" <[email protected]> wrote in message
    news:[email protected]...
    What behavior are you seeing that is preventing you from using
    Integers?
    -Patrick
    Nathan Voxland wrote:
    I am using 3.0.3 and have a PC class that uses application
    identity
    and
    MSSQL server, so we are using auto-increment fields for our
    primary
    keys.
    In the past (with sequence-generated ids) we have used Integers
    for
    our
    mapped attributes, but with the application identity, it seems
    we
    need
    to
    use ints. Is there a reason for this, or is it a bug?
    Nathan
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Trying to create cmp correctly(auto-increment);error while running

    I am using the latest versions of Jboss(4.0.5.GA) and Lomboz(R-3.2-200610201336) along with SQL Server 2005 and Microsoft's SQL Server 2005 JDBC driver.
    Lomboz used xdoclet to create the java files based on the SQL table but it did not put anything in the DoctorBean.java file telling it that the primary key was auto-incremented.
    Using the JSP files, I can retreive data out of the database fine so I know the connection and drivers are set up properly.
    Here is the error:
    09:16:46,815 WARN  [ServiceController] Problem starting service jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(Unknown Source)
        at org.jboss.mx.loading.RepositoryClassLoader.loadClassLocally(RepositoryClassLoader.java:197)
        at org.jboss.mx.loading.UnifiedLoaderRepository3.loadClassFromClassLoader(UnifiedLoaderRepository3.java:277)
        at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:284)
        at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:511)
        at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:89)
        at org.jboss.mx.loading.LoaderRepositoryClassLoader.loadClass(LoaderRepositoryClassLoader.java:90)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:89)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityCommandMetaData.<init>(JDBCEntityCommandMetaData.java:73)
        at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>(JDBCEntityMetaData.java:952)
        at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init>(JDBCApplicationMetaData.java:378)
        at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:89)
        at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:736)
        at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:424)
        at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:368)
        at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:172)
        at org.jboss.ejb.EjbModule.startService(EjbModule.java:414)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
        at $Proxy0.start(Unknown Source)
        at org.jboss.system.ServiceController.start(ServiceController.java:417)
        at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy25.start(Unknown Source)
        at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:662)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
        at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
        at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
        at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
        at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
        at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy26.start(Unknown Source)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
        at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy8.deploy(Unknown Source)
        at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
        at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
        at $Proxy0.start(Unknown Source)
        at org.jboss.system.ServiceController.start(ServiceController.java:417)
        at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy4.start(Unknown Source)
        at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy5.deploy(Unknown Source)
        at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
        at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
        at org.jboss.Main.boot(Main.java:200)
        at org.jboss.Main$1.run(Main.java:490)
        at java.lang.Thread.run(Unknown Source)
    09:16:46,862 INFO  [EJBDeployer] Deployed: file:/C:/java/jboss-4.0.5.GA/server/default/deploy/MedicalEJB.jar
    09:16:46,987 INFO  [TomcatDeployer] deploy, ctxPath=/MedicalWeb, warUrl=.../tmp/deploy/tmp63256MedicalWeb-exp.war/
    09:16:47,315 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
    09:16:47,503 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
    --- MBeans waiting for other MBeans ---
    ObjectName: jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
      State: FAILED
      Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
    ObjectName: jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
      State: FAILED
      Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: 01Simple Doctor table:
    CREATE TABLE [dbo].[Doctors](
        [DoctorId] [int] IDENTITY(1,1) NOT NULL,
        [firstName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
        [lastName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    CONSTRAINT [PK_Doctors] PRIMARY KEY CLUSTERED
        [DoctorId] ASC
    )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]Most of DoctorBean.java was createded automatically with xdoclet, I created these items manually but with no success:
    * @jboss.entity-command
    * name="mssql-get-generated-keys"
    * @jboss.unknown-pk
    * class="java.lang.Integer"
    * column-name="doctorid"
    * field-name="doctorid"
    * jdbc-type="INTEGER"
    * sql-type="int"
    * auto-increment="true"DoctorBean.java:
    package com.bdintegrations.MedicalApp.EJB;
    import java.rmi.RemoteException;
    import javax.ejb.EJBException;
    import javax.ejb.EntityContext;
    import javax.ejb.RemoveException;
    * <!-- begin-xdoclet-definition -->
    * @ejb.bean name="Doctor"
    *    jndi-name="Doctor"
    *    type="CMP"
    *  primkey-field="doctorid"
    *  schema="DoctorSCHEMA"
    *  cmp-version="2.x"
    *  @ejb.persistence
    *   table-name="dbo.Doctors"
    * @ejb.finder
    *    query="SELECT OBJECT(a) FROM DoctorSCHEMA as a" 
    *    signature="java.util.Collection findAll()" 
    * @ejb.pk
    *  class="java.lang.Object"
    *  generate="false"
    * @jboss.entity-command
    * name="mssql-get-generated-keys"
    * @jboss.unknown-pk
    * class="java.lang.Integer"
    * column-name="doctorid"
    * field-name="doctorid"
    * jdbc-type="INTEGER"
    * sql-type="int"
    * auto-increment="true"
    * @jboss.persistence
    * datasource="java:/MSSQLDS"
    * datasource-mapping="MS SQLSERVER2005"
    * table-name="dbo.Doctors"
    * create-table="false" remove-table="false"
    * alter-table="false"
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract class DoctorBean implements javax.ejb.EntityBean {
         * <!-- begin-user-doc -->
         * The  ejbCreate method.
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.create-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public java.lang.Object ejbCreate(String firstName, String lastName) throws javax.ejb.CreateException {
            setFirstname(firstName);
            setLastname(lastName);
            return null;
            // end-user-code
         * <!-- begin-user-doc -->
         * The container invokes this method immediately after it calls ejbCreate.
         * <!-- end-user-doc -->
         * @generated
        public void ejbPostCreate() throws javax.ejb.CreateException {
            // begin-user-code
            // end-user-code
         * <!-- begin-user-doc -->
         * CMP Field doctorid
         * Returns the doctorid
         * @return the doctorid
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.persistent-field
         * @ejb.persistence
         *    column-name="DoctorId"
         *     jdbc-type="INTEGER"
         *     sql-type="int identity"
         *     read-only="false"
         * @ejb.pk-field
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract java.lang.Integer getDoctorid();
         * <!-- begin-user-doc -->
         * Sets the doctorid
         * @param java.lang.Integer the new doctorid value
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract void setDoctorid(java.lang.Integer doctorid);
         * <!-- begin-user-doc -->
         * CMP Field firstname
         * Returns the firstname
         * @return the firstname
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.persistent-field
         * @ejb.persistence
         *    column-name="firstName"
         *     jdbc-type="VARCHAR"
         *     sql-type="varchar"
         *     read-only="false"
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract java.lang.String getFirstname();
         * <!-- begin-user-doc -->
         * Sets the firstname
         * @param java.lang.String the new firstname value
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract void setFirstname(java.lang.String firstname);
         * <!-- begin-user-doc -->
         * CMP Field lastname
         * Returns the lastname
         * @return the lastname
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.persistent-field
         * @ejb.persistence
         *    column-name="lastName"
         *     jdbc-type="VARCHAR"
         *     sql-type="varchar"
         *     read-only="false"
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract java.lang.String getLastname();
         * <!-- begin-user-doc -->
         * Sets the lastname
         * @param java.lang.String the new lastname value
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract void setLastname(java.lang.String lastname);
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#ejbActivate()
        public void ejbActivate() throws EJBException, RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#ejbLoad()
        public void ejbLoad() throws EJBException, RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#ejbPassivate()
        public void ejbPassivate() throws EJBException, RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#ejbRemove()
        public void ejbRemove() throws RemoveException, EJBException,
                RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#ejbStore()
        public void ejbStore() throws EJBException, RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
        public void setEntityContext(EntityContext arg0) throws EJBException,
                RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#unsetEntityContext()
        public void unsetEntityContext() throws EJBException, RemoteException {
            // TODO Auto-generated method stub
        public DoctorBean() {
            // TODO Auto-generated constructor stub
    }JSP client page snippet:
    <%
    DoctorHome home = DoctorUtil.getHome();
    Doctor doctor = home.create("Jon","Smith");
    %>
    <%=doctor.getDoctorid() %>thanks

    Nevermind.. no one bothered to inform the developer that the path to the collection AND the path to the directory that the collection is for are different on this other server.
    Fixed.

Maybe you are looking for

  • JDBC connection to two different machines from the same program

    I want to use JDBC to connect to two different databases that are on two different MySQL installations on two different machines. One of the installations is MySQL 4.1.12 and the other is 4.1.14-nt For some reason, all my statements seem to be going

  • SB Audigy Audio Softwa

    I have a gateway computer, but I don't have any software. Like I don't have any programs to change my sound settings. Where do I get the software? I wanna use my headphones, but I have no options anywhere to choose to use a headphone setting. Please

  • Bluetooth Headphones in Garageband Lag

    When I try to record guitar in garageband through my Beats Studio Wireless headphones there is a noticable lag in the audio output. I was wandering if there is any solution to this because it would be nice to be able to use them with no cable to get

  • EJB Books

    I have been programming on JSP/Servlets/Java Beans for one year. Now I want to learn EJB. Could you please tell me what books are good for me to start with? Thanks!

  • XSL Version  2.0

    Hi there, does ORACLE intend to support the XSL Version 2.0 when the w3c recommends it? best regards Alex