JPA - Mysql - GeneratedValue

I am using Mysql with Eclipselink 2.0.1 and have the following situation:
My Entity is using a field declared like this:
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long referenceNumber;
The DDL is generated and in my database all tables are created. If I insert a new record within my EJB I am getting as the "referenceNumber" not "1" - I am getting sometimes "50" sometimes "1232". It is a completely random id. Is it possible to get an ID which is starting by 1 and incrementing automatically ?
I have tried to use GenerationType.IDENTY but this has some problems with cascading operations, so I do not want to use it.

Hello,
I just started playing with JPA and mysql. My tables's primary keys use auto-increment option in database. To tell application how to work with these fields I use following statements and everything works perfect after some troubles in the beggining of course :-)) :
@Entity
@Table(name = "C_ADRESA_TYP") //, schema = "KMPV"
public class CiselnikAdresaTyp implements Serializable{
     private static final long serialVersionUID = 1L;
     @Id
     //@Required - cannot be used when using auto-increment and IDENTITY gerenator
     @Hidden
     @Column(name = "PK_ADRESA_TYP", insertable = false, nullable = false, updatable = true)
     @GeneratedValue(strategy=GenerationType.IDENTITY)
     private int pkAdresaTyp;
     @Required
     @Column(name = "KOD", length = 30, nullable = false, updatable = true)
     private String kod;
.....etc
In case of you are experiencing still some troubles witch some cascade actions, this could be regarding your foreing keys, exactly on on update on delete actions.
Hope it'll help.
archenroot
Edited by: user8916162 on Nov 9, 2010 11:18 AM

Similar Messages

  • Jpa-Mysql

    Hi
    i am trying to run an application which was running on oracle,since i dint have oracle i am migrating the code to mysql, the entity class has
    @SequenceGenerator(name = "BID_SEQUENCE_GENERATOR", sequenceName = "BID_SEQUENCE", initial Value = 1, allocation Size = 1)
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "BID_SEQUENCE_GENERATOR")
    annotations ........... in my persistance.xml am using org.hibernate.dialect.MySQLDialect when i deplaoy the application i get error saying that dialect does not support
    sequence .After goggling i found that mysql does not support sequence i generated table in mysql by modifying the defination
    CREATE TABLE SEQUENCE (
    SEQ_NAME VARCHAR(50) NOT NULL,
    SEQ_COUNT int(38) AUTO_INCREMENT ,
    PRIMARY KEY (SEQ_COUNT));
    but i cannot depoly app as mysql dialect does not support sequnce..... is there any alternative.

    yes, use auto_increment columns in combination with the IDENTITY generation type. That works flawlessly on MySQL. But it does mean you will have to change all your entities that are currently using a sequence.
      @Id
      @GeneratedValue(strategy=IDENTITY)
      @Column(name="id")
      private int id;

  • JPA annotation @GeneratedValue(strategy = GenerationType.???)

    What is the recommended strategy for handling identity fields? Suppose I have a table named Employee with a primary key column emp_id. With oracle 10g, we created a sequence emp_id_seq and a trigger to automatically insert emp_id_seq.nextval into emp_id when a row is inserted into Employee table. Therefore, user does not need to provide a value for emp_id for insertion. Given a table like this, how should we choose the GenerationType?
    If this is not the right place for this type of questions, please let me where I should post this question. Thanks

    In general I would not recommend this, and instead let EclipseLink insert the id value and use an increment on the sequence to allow preallocation and much better performance. Maybe have the trigger only assign the value if not set.
    However, you can do this either by:
    - Using a ReturnPolicy for the id (@ReturnInsert instead of @GeneratedValue)
    - In the OraclePlatform call setSupportsIdentity(true) (such as using a SessionCustomizer), this will then allow identity like sequencing
    James : http://www.eclipselink.org

  • Question about the Glassfish Persistance engine

    Goodday,
    I am working with Sun Appserver (glassfish v2). And using entity beans to generate my mysql database and work with the data.
    Now somting catched my eye the last few days if your using the @OneTOne() method. The persistence engine makes the object a could be null. For instance I have the folowing code:
        @Id
        @GeneratedValue
        @Column(name = "Mandatecode", nullable=false)
        public int getMandatecode() { return Mandatecode; }
        public void setMandatecode(int str) { this.Mandatecode = str; }
        @Column(name = "Projectnaam", length=20, nullable=false)
        public String getProjectnaam() { return Projectnaam; }
        public void setProjectnaam(String str) { this.Projectnaam = str; }
        //This should be true but for testing purpuses its left to false.
        @OneToOne()
        @JoinColumn(name="ProjectType")
        public ProjectSoort getProjecttype () { return projecttype; }
        public void setProjecttype (ProjectSoort ps) { this.projecttype = ps; }It would result in the following table:
    Mandatecode
    Projectname
    ProjectType
    But all the collums have may not be null. However I want to ProjectType to be aible to be null in this table. How do I do this?

    I'm not sure what you're asking, but a useful resource that may answer your question is the article [Master the New Persistence Paradigm with JPA|http://www.devx.com/Java/Article/33650/], an article which focuses on JPA , MySQL, and MySQL DDL generation.

  • JPA with MySQL-Data-Source

    Hello Forum,
    I have a question regarding usage of a MySQL-Data-Source in combination with JPA
    on the SAP NetWeaver Application Server, Java ™ EE 5 Edition.
    I have setup a custom datasource like explained in paper:
    "Working with Database Tables, DataSources and JMS Resources"
    - registered the database driver via telnet (Using mysql-connector-java-5.0.3-bin.jar)
    - created the data-sources.xml file underneath the META-INF dir of the EAR project
    [code]
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE data-sources SYSTEM "data-sources.dtd" >
    <data-sources>
      <data-source>
        <data-source-name>titan_cruises_ds</data-source-name>
        <driver-name>mysql-connector-java-5.0.3-bin.jar</driver-name>
         <init-connections>1</init-connections>
         <max-connections>10</max-connections>
         <max-time-to-wait-connection>60</max-time-to-wait-connection>
         <expiration-control>
              <connection-lifetime>600</connection-lifetime>
              <run-cleanup-thread>60</run-cleanup-thread>
         </expiration-control>
         <sql-engine>native_sql</sql-engine>
        <jdbc-1.x>
          <driver-class-name>com.mysql.jdbc.Driver</driver-class-name>
          <url>jdbc:mysql://ourHost.internal.com:3306/practise_titan_cruises</url>
          <user-name>myUser</user-name>
          <password>myPass</password>
        </jdbc-1.x>
      </data-source>
    </data-sources>
    [/code]
    After that I manually created the persistence.xml underneath the META-INF dir of the EJB project.
    [code]
    <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
         <persistence-unit name="titan_cruises_pu">
              <jta-data-source>titan_cruises_ds</jta-data-source>
         </persistence-unit>
    </persistence>
    [/code]
    After that I created the Entity named "Cabin" and the corresponding table within the db.
    Entity code:
    [code]
    package de.collogia.beans.pojo.ship;
    import java.io.IOException;
    import java.io.Serializable;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.Id;
    import javax.persistence.Table;
    This persisted POJO class models the cabin data.
    <p>
    In this class persistence annotations are placed on the getter methods
    of the attributes. This tells the persistence manager to access them
    via the corresponding get- and set-Methods.</p>
    (Unfortunately this does not work on NetWeaver and I had to place them
    on field level aggain...)
    @author Henning Malzahn ([email protected])
    svn-revision:         $Rev:: 670                                           $:
    svn-lasted-edited-by: $Author:: henning                                    $:
    svn-last-changed:     $Date:: 2007-02-21 21:49:51 +0100 (Wed, 21 Feb 2007) $:
    @Entity
    @Table(name = "cabin")
    public class Cabin implements Serializable {
        /** The generated serial version UID used for serialization. */
        private static final long serialVersionUID = -8522497314498903378L;
        /** The actual version number of this class used for serialization. */
        private static int actualVersion = 1;
        /** The cabin's id. */
        @Id
        @GeneratedValue
        @Column(name = "id")
        private long id;
        /** The cabin's name */
        @Column(name = "name")
        private String name;
        /** The cabin's deck level */
        @Column(name = "deck_level")
        private int deckLevel;
        /** The cabin's ship id */
        @Column(name = "ship_id")
        private int shipId;
        /** The cabin's bed count */
        @Column(name="bed_count")
        private int bedCount;
    /---- Serialization/ Deserialization methods -/
    Method that is responsible for deserialization of the object.
    @param in The <code>ObjectInputStream</code> object to read
              the data from.
    @throws IOException That may occur when reading from the
                        <code>ObjectInputStream</code> object
    @throws ClassNotFoundException That may occur when invoking the default
                                   deserialization mechanism.
        private void readObject(final java.io.ObjectInputStream in)
            throws IOException, ClassNotFoundException {
            /* Invoke default deserialization mechanism. */
            in.defaultReadObject();
            /* Read the actual version number of the class. */
            actualVersion =  in.readInt();
        } // End of readObject()
    Method that is responsible for serialization of the object.
    @param out The <code>ObjectOutputStream</code> object to write
               the data to.
    @throws IOException That may occur when writing to the
                        <code>ObjectOutputStream</code> object.
        private void writeObject(final java.io.ObjectOutputStream out)
            throws IOException {
            /* Invoke default serialization mechanism. */
            out.defaultWriteObject();
            /* Write the actual version number of the class. */
            out.writeInt(actualVersion);
        } // End of writeObject()
    /---- Defining constructors -/
    Private default constructor.
        private Cabin() {
        } // End of default constructor
    Full constructor.
    @param name The cabin's name.
    @param deckLevel The cabin's deck level.
    @param shipId The cabin's ship id.
    @param bedCount The cabin's bed count.
        public Cabin(final String name,
                     final int deckLevel,
                     final int shipId,
                     final int bedCount) {
            this.name = name;
            this.deckLevel = deckLevel;
            this.shipId = shipId;
            this.bedCount = bedCount;
        } // End of full constructor
    /---- Overridden class methods -/
    Returns a string representation of the cabin's data.
    @see java.lang.Object#toString()
        @Override
        public String toString() {
            StringBuffer strBuf = new StringBuffer();
            strBuf.append(this.name);
            strBuf.append("\n");
            strBuf.append(this.deckLevel);
            strBuf.append("\n");
            strBuf.append(this.shipId);
            strBuf.append("\n");
            strBuf.append(this.bedCount);
            return strBuf.toString();
        } // End of toString()
    /---- Defining instance methods -/
    Get method for the member "<code>id</code>".
    @return Returns the id.
        public long getId() {
            return this.id;
    Set method for the member "<code>id</code>".
    HTDODO hm: Check whether it is possible to have setId method
    using private accesss level with NetWeaver JPA-Provider!
    @param id The id to set.
        private void setId(final long id) {
            this.id = id;
    Get method for the member "<code>name</code>".
    @return Returns the name.
        public String getName() {
            return this.name;
    Set method for the member "<code>name</code>".
    @param name The name to set.
        public void setName(final String name) {
            this.name = name;
    Get method for the member "<code>deckLevel</code>".
    @return Returns the deckLevel.
        public int getDeckLevel() {
            return this.deckLevel;
    Set method for the member "<code>deckLevel</code>".
    @param deckLevel The deckLevel to set.
        public void setDeckLevel(final int deckLevel) {
            this.deckLevel = deckLevel;
    Get method for the member "<code>shipId</code>".
    @return Returns the shipId.
        public int getShipId() {
            return this.shipId;
    Set method for the member "<code>shipId</code>".
    @param shipId The shipId to set.
        public void setShipId(final int shipId) {
            this.shipId = shipId;
    Get method for the member "<code>bedCount</code>".
    @return Returns the bedCount.
        public int getBedCount() {
            return this.bedCount;
    Set method for the member "<code>bedCount</code>".
    @param bedCount The bedCount to set.
        public void setBedCount(final int bedCount) {
            this.bedCount = bedCount;
    } // End of class Cabin
    [/code]
    After that I created the TravelAgentBean, a Stateless Session Bean, implementing
    a remote interface that allows construction and persisting of new Cabin objects:
    [code]
    package de.collogia.beans.session.stateless;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import de.collogia.beans.pojo.ship.Cabin;
    Class that implements the <code>TravelAgentRemote</code> interface
    and defines the business methods of the TravelAgent service.
    @author Henning Malzahn ([email protected])
    svn-revision:         $Rev:: 670                                           $:
    svn-lasted-edited-by: $Author:: henning                                    $:
    svn-last-changed:     $Date:: 2007-02-21 21:49:51 +0100 (Wed, 21 Feb 2007) $:
    @Stateless
    public class TravelAgentBean implements TravelAgentRemote {
        /** The <code>Log</code> object for this class. */
    //    private static final Log LOGGER;
        /** The <code>PersistenceManager</code> object. */
        @PersistenceContext(unitName = "titan_cruises_pu")
        EntityManager em;
    /---- Static initializer -/
    //    static {
    //        LOGGER = LogFactory.getLog(TravelAgentBean.class);
    //    } // End of static initializer block
    /---- Implementing remote interface methods -/
    {@inheritDoc}
        public void createCabin(final Cabin cabin) {
            this.em.persist(cabin);
        } // End of createCabin()
    } // End of class TravelAgentBean
    [/code]
    After that I created a Controller class containing a main method that looks up the remote
    interface of the TravelAgentBena like explained in document "Accessing Enterprise JavaBeans Using JNDI
    in SAP NetWeaver Application Server, Java ™ EE 5 Edition" written by Validimir Pavlov of SAP NetWeaver
    development team.
    Unfortunately I receive an Exception after invoking the createCabin(...) method.
    On the console of the NWDS I receive:
    [code]
    javax.ejb.EJBException: Exception in getMethodReady() for stateless bean sap.com/test2Earannotation|test2Ejb.jarannotation|TravelAgentBean;
    nested exception is: com.sap.engine.services.ejb3.util.pool.PoolException: javax.ejb.EJBException: Cannot perform injection over bean instance
    Caused by: java.lang.RuntimeException: The persistence unit is inconsistent:
    The entity >>de.collogia.beans.pojo.ship.Cabin<< is mapped to the table >>cabin<<, which does not exist.
    [/code]
    But if I look at the log file located in "C:\NWAS_JAVAEE5\JP1\JC00\j2ee\cluster\server0\log\defaultTrace.0.trc"
    I see the real reason is:
    [code]
    [EXCEPTION]
    #6#1064#42000#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 '"cabin"' at line 1#collnx02.collogia.de:3306:null:practise_titan_cruises#select * from "cabin"#com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:
    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 '"cabin"' at line 1
         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3124)
         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1149)
         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1262)
         at com.sap.sql.jdbc.basic.BasicPreparedStatement.executeQuery(BasicPreparedStatement.java:99)
         at com.sap.sql.jdbc.direct.DirectPreparedStatement.executeQuery(DirectPreparedStatement.java:307)
         at com.sap.sql.jdbc.direct.DirectPreparedStatement.executeQuery(DirectPreparedStatement.java:264)
         at com.sap.engine.services.dbpool.wrappers.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:274)
    [/code]
    My goodness - what a long post - sorry for this - I hope I provided all information
    necessary to deal with the issue.
    Am I thinking in the right direction to blame attribute [code]<sql-engine>native_sql</sql-engine>[/code]
    of file data-sources.xml for the beaviour? Are there any other argument options than native_sql?
    Thanks in Advance!
    Henning Malzahn

    Hi Henning,
    > Despite the fact it's working now I have to do some
    > changes to my code currently
    > developed using JBoss/ Hibernate combination.
    > Hibernate allows you to have the
    > default no-arg constructor with private visibility -
    > any special reason for the fact that
    > only protected is allowed on NetWeaver?
    Here we strictly implemented the checks according to the requirements of the JPA specification. Technically, we could do with private constructors as well. But the JPA specifications requires the constructor to be protected to allow a JPA implementation to subclass entities if needed.
    > The entities in the project are final classes
    > so declaring a ctor protected doesn't really make
    > sense...
    For the same reason, your entities should not be final. Are we missing a check here ?
    > Also the persistence.xml parameter
    >
    hibernate.hbm2ddl.auto
    with the value of
    > create-drop is very useful while
    > developing the app - everytime you deploy the project
    > you get a fresh database.
    > Is there a comparable option for NetWeaver?
    No, unfortunately, there is no comparable option in SAP JPA (yet). We understand that there is a need for forward mapping. We would have liked to delegate this task to the JPA design time (i.e. Dali). However, we had to discover that Dali does not perform this task properly and we can't recommend using it any more.
    Consequently, there is no automatic schema generation in SAP JPA 1.0.
    >
    > Another thing is the extra TMP_SEQUENCE table which
    > isn't necessary using JBoss and
    > Hibernate - what's the reason for that?
    With Hibernate Entity Manager, the id generation strategy in use with GenerationType.AUTO depends on the database dialect. This means that depending on the database dialect, IDENTITY columns, SEQUENCES or generator tables (TableHiLo) are required. As Hibernate has the before mentioned schema generation property this fact can be hidden to the user.
    In SAP JPA, we are always using a table generator if GenerationType.AUTO is used. This allows for better portability across databases. It requires the table TMP_SEQUENCE. As we unfortunately do not have a schema generation capability, the user must create this table.
    Best regards,
    Adrian

  • JPA cascade with  @GeneratedValue(strategy=GenerationType.IDENTITY)

    If anyone has got cascading persistance working in JPA with database generated primary keys I'd be much obliged if you could let me know how.
    Am attempting to use tables with database auto generated primary keys (MySQL AUTO_INCREMENT), and using the JPA cascade features. But I can't see how to make it work.
    The problem is that if you cascade persist a series of entities, you need to know the database primary keys before you persist to the database.
    If I remove all the cascades in my @entity's, and explicitly persist entities in the correct order so the primary keys are set before them being needed, then all is ok.
    When I put the cascades in, my JPA implementation (Toplink) attempts to create the entities with foreign keys to tables with the yet to be generated primary keys all null. I was hoping JPA/Toplink would be clever enough to persist the entities in order, setting the database generated primary keys as it went.
    Has anyone tried this in Hibernate?
    Sampe code exerts that does not work:
    @Entity
    public class Address implements Serializable {
       private long id;
       private Collection<Contact> contacts = new ArrayList<Contact>();
       @OneToMany(cascade = { CascadeType.ALL })
       public Collection<Contact> getContacts() {
          return contacts;
    @Entity
    public class Contact implements Serializable {
       private long id;
       @Id
       @Column(updatable = false)
       @GeneratedValue(strategy = GenerationType.IDENTITY)
       public long getId() {
          return this.id;
    CREATE TABLE address (
           id BIGINT NOT NULL AUTO_INCREMENT
         , address_line_1 VARCHAR(64)
         , address_line_2 VARCHAR(64)
         , address_line_3 VARCHAR(64)
         , suburb VARCHAR(64)
         , postcode VARCHAR(16)
         , state VARCHAR(64)
         , country_code CHAR(2)
         , PRIMARY KEY (id)
    CREATE TABLE contact (
           id BIGINT NOT NULL AUTO_INCREMENT
         , address_id BIGINT
         , contact_type CHAR(10)
         , value VARCHAR(255)
         , PRIMARY KEY (id)
         , INDEX (address_id)
         , CONSTRAINT FK_contact_address FOREIGN KEY (address_id)
                      REFERENCES address (id)
    );

    The way I have it, the contact does need annotations as it is a bidirectional link. The contact defines the link and the address has a mappedBy="address".
    If you remove the annotations on contact, I think you will need to set up a unidirectional one-to-many link and my 'text book' says you need to have a join table to implement this. I tried all kinds of ways to have a unidirectional one-to-many link without a join table, but never succeeded.
    I found if a persist failed it would still use up sequence numbers (Hibernate and MySQL), but I did not come accross your problem. I found it useful to look on the SQL Database logs to see exactly what SQL was getting to the server.
    My code - so far working fine, am in mid development though.
    Address.java:
    @Entity
    @Table(name = "address", schema = "z")
    public class Address implements Serializable {
       private static final long serialVersionUID = 1L;
       private long id;
       private String addressLine1;
       private Collection<Contact> contacts = new ArrayList<Contact>();
       public Address() {
          super();
       @Id
       @Column(updatable = false)
       @GeneratedValue(strategy = GenerationType.IDENTITY)
       public long getId() {
          return this.id;
       public void setId(long id) {
          this.id = id;
       @Column(name = "address_line_1")
       public String getAddressLine1() {
          return this.addressLine1;
       public void setAddressLine1(String addressLine1) {
          this.addressLine1 = addressLine1;
       @OneToMany(mappedBy="address", cascade={CascadeType.ALL})
       public Collection<Contact> getContacts() {
          return contacts;
       public void setContacts(Collection<Contact> contacts) {
          this.contacts = contacts;
    Contact.java:
    @Entity
    @Table(name = "contact", schema = "z")
    public class Contact implements Serializable {
       private static final long serialVersionUID = 1L;
       private long id;
       private Address address;
       private String value;
       private String contactType;
       public Contact() {
          super();
       @Id
       @Column(updatable = false)
       @GeneratedValue(strategy = GenerationType.IDENTITY)
       public long getId() {
          return this.id;
       public void setId(long id) {
          this.id = id;
       @ManyToOne (cascade={CascadeType.ALL})
       @JoinColumn(name="address_id", referencedColumnName="id", nullable=false, updatable=false)
       public Address getAddress() {
          return this.address;
       public void setAddress(Address address) {
          this.address = address;
       public String getValue() {
          return this.value;
       public void setValue(String value) {
          this.value = value;
       @Column(name = "contact_type")
       public String getContactType() {
          return this.contactType;
       public void setContactType(String contactType) {
          this.contactType = contactType;
    }

  • Can not do JPA/Hibernate ... Reverse Engineering with MySQL

    Hello,
    I'm using MyEclipse 7.1.1 and MySQL 5.1.34. The MySQL connector with java is mysql-connector-java-5.1.7-bin. I tried so many time to generate Hibernate/JPA class by MyEcipse but it still did not work. Here below are my error log (which i copied from workspace error log):
    !ENTRY org.eclipse.core.jobs 4 2 2009-05-29 22:07:20.709 !MESSAGE An internal error occurred during: "Generating Artifacts". !STACK 0 java.util.NoSuchElementException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:844) at java.util.HashMap$ValueIterator.next(HashMap.java:871) at com.genuitec.eclipse.hibernate.tool.MESingleClassExporter.doStart(MESingleClassExporter.java:59) at com.genuitec.eclipse.hibernate.tool.hbm2x.VAbstractExporter.start(VAbstractExporter.java:97) at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$3.execute(GenerateArtifactsJob.java:582) at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:64) at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:95) at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:417) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
    These information below are my system information that i copied from Myeclipse Installation Summary:
    *** Date: Friday, May 29, 2009 10:37:27 PM CDT ** System properties: OS=MacOSX OS version=10.5.7 Java version=1.5.0_16 *** MyEclipse details: MyEclipse Enterprise Workbench Version: 7.1.1 Build id: 7.1.1-20090310 *** Eclipse details: MyEclipse Enterprise Workbench Version: 7.1.1 Build id: 7.1.1-20090310 Eclipse Platform Version: 3.4.1.r341_v20080731-9I96EiDElYevwz-p1bP5z-NlAaP7vtX6Utotqsu Build id: M20080911-1700 Eclipse Java Development Tools Version: 3.4.1.r341_v20080709-0800-7o7tEAfEF_U5qyUgrb2HAp539P97 Build id: M20080709-0800 Eclipse Graphical Editing Framework GEF Version: 3.4.1.v20080806-67718083A56B4H2A3213573 Build id: 200809101400 Eclipse RCP Version: 3.4.100.r341_v20080814-989JESIEdAciFYfkZZsBfSwQ2341 Build id: M20080703-0800 Eclipse Plug-in Development Environment Version: 3.4.1.r341_v20080731-7T7U0E9mlRIuGUYviF_VP Build id: M20080703-0800 Eclipse startup command=-os macosx -ws carbon -arch x86 -showsplash -launcher /Library/Genuitec/MyEclipse 7.1 1/myeclipse.app/Contents/MacOS/myeclipse -name Myeclipse --launcher.library /Library/Genuitec/MyEclipse 7.1 1/myeclipse.app/Contents/MacOS//../../../../Common/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.0.101.R34x_v20080731/eclipse_1115.so -startup /Library/Genuitec/MyEclipse 7.1 1/myeclipse.app/Contents/MacOS/../../../../Common/plugins/org.eclipse.equinox.launcher_1.0.101.R34x_v20080819.jar -clean -configuration ../../../configuration -keyring /Users/lamnguyen/.eclipse_keyring -consoleLog -showlocation -vm /System/Library/Frameworks/JavaVM.framework
    Here is my config file:
    <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence     http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">     <persistence-unit name="NDProcessorPU" transaction-type="RESOURCE_LOCAL"> <provider>oracle.toplink.essentials.PersistenceProvider</provider>   <properties> <property name = "toplink.jdbc.driver" value = "com.mysql.jdbc.Driver"/> <property name = "toplink.jdbc.url" value = "jdbc:mysql://localhost/netdirs?autoReconnect=true"/> <property name = "toplink.jdbc.user" value = "root"/>   </properties> </persistence-unit>   </persistence>
    Please help me to resolve this problem. I tried so many ways such as: change others mysql connector driver version, refresh, re-install myeclipse... Someone who have any solutions please help me.
    Thank you!

    perhaps posting this question in a forum for MyEclipse would help?
    Or even Hibernate?
    None of these are JDBC related issues really, but probably configuration or setup of those.
    And while I could spend time noting that it is an eclipse error and thus some problem there in the first place...

  • Is it possible to use JPA Catalog & Schema in MySQL?

    Dear All,
    Could anyone explain the difference between JPA Catalog and Schema when using MySQL database? Below is an example where I have successfully used both Catalog and Schema to reference different databases:
    @Table(name="CUSTOMER", catalog="catalogName", schema="")  // Worked
                                          or
    @Table(name="CUSTOMER", catalog="", schema="schemaName")  // Worked
                                       but NOT
    @Table(name="CUSTOMER", catalog="catalogName", schema="schemaName") which resulted the following database exception:
    JDO76609: Got SQLException executing statement "CREATE TABLE catalogName.schemaName....
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException...
    Not sure whether MySQL support the use of both Catalog and Schema at the same time, or do they both mean the same thing which is just database instances? In other word, it does not support the idea of defining a Catalog within a Schema, or vice versa. Likewise, MySQL seems to use Catalog/Schema as database instance interchangeably with both on the same level. This means that an application will likely be required to create many database instances to be used in place of Schema.
    My understanding of the use of Catalog and Schema would be: catalogName.schemaName.CUSTOMER or schemaName.catalogName.CUSTOMER but does not reflect how MySQL work.
    It would be interesting to hear from others who has used MySQL as the underlying JPA database.
    Thanks a lot,
    Jack

    I use Photoshop Elements 3 ("Elements" not "Album"). I wasn't aware of an upgrade to PSE 3.2. If I upgrade will the Catalog be converted to a form that is compatible with PSA SE 3.2?

  • Proper JPA mapping for MySQL SET type?

    If I have a MySQL ENUM type, it seems straightforward to map it to "int" in Java. However, what about a MySQL SET type? I don't see an obvious way that that should be mapped to Java. I looked for examples of this, but I couldn't find any.
    if there's a better place to ask questions about this, please direct me.

    Hi Vinod,
    due to performance improvement when using forward only cursor we changed the default for the resultset type from TYPE_SCROLL_SENSITIVE to TYPE_FORWARD_ONLY starting with JDBC driver version 7.6. So I guess the exception comes from a statement where you didn't set the resultset type while creating it. Please check if all of the statements that you want to be scrollable have set the correct resultset type.
    Regards,
    Marco

  • JPA: is it possilble to create a entity class for a MySQL view?

    Thanks in advance.

    Yes, just use the view name instead of the table name in the @Table.
    -- James : http://www.eclipselink.org

  • GenerationType.AUTO doesn't work correctly with Kodo and MySQL

    Greetings,
    I'm migrating applications from JBoss/Hibernate to WebLogic/Kodo. The following column annotation:
    @Id
    @Column(name="CUSTOMER_ID")
    @GeneratedValue(strategy = GenerationType.AUTO)
    public long getCustomerId()
    is supposed to generate auto-increment primary key in mysql. This is what happens with Hibernate. With Kodo, this seems to be equivalent with GenerationType.TABLE as a table named openjpa_sequence_table is created, containing sequence values. So what should one do in order to be able to use true auto-increment strategy with MySQL and Kodo ?
    Many thanks in advance,
    Nicolas

    Hi Nicolas,
    By setting the generation strategy to AUTO, you're essentially letting the JPA provider choose which strategy to use. It looks like Kodo is using the TABLE strategy by default and Hibernate is using the IDENTITY strategy here. You can set the strategy to IDENTITY if you want Kodo to behave similarly to Hibernate. However, it's worth pointing out that there may be a reason for Kodo not using the IDENTITY strategy by default.
    The docs at: http://edocs.bea.com/wls/docs103/kodo/full/html/ref_guide_pc_oid.html#ref_guide_pc_oid_pkgen_autoinc
    point out the following:
    "Statements inserting into tables with auto-increment / identity columns cannot be batched. After each insert, Kodo must go back to the database to retrieve the last inserted auto-increment value to set back in the persistent object. This can have a negative impact on performance. "
    - Matt

  • JPA and JSF - Problem persisting object

    Hi all.
    I'm having some trouble with JPA, persisting an object to a MySQL table.
    Let's say I have a simple bean, Message:
    package my.package
    import java.io.Serializable;
    import javax.persistence.Id;
    import javax.persistence.Entity;
    import javax.persistence.Column;
    import javax.persistence.Table;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    @Entity
    @Table(name="messages")
    public class Message implements Serializable {
         @Id
         @GeneratedValue(strategy=GenerationType.AUTO)
         private int id;
         @Column(name="message_text")
         private String message;
         @Column(name="message_author")
         private String author;
         public String getMessage() {
              return this.message;
         public void setMessage(String message) {
              this.message = message;
         public String getAuthor() {
              return this.author;
         public void setAuthor(String author) {
              this.author = author;
    }And a controller for this Message bean:
    package my.package;
    import javax.annotation.Resource;
    import javax.persistence.Query;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.PersistenceUnit;
    import javax.transaction.UserTransaction;
    public class MessageController {
         @PersistenceUnit(unitName="em1")
         private EntityManagerFactory emf;
         @Resource
         private UserTransaction utx;
         private Message message;
         public Message getMessage() {
              return this.message;
         public void setMessage(Message message) {
              this.message = message;
         public String save() {
              EntityManager em = null;
              String returnValue = "";
              try {
                   em = this.emf.createEntityManager();
                   utx.begin();
                   em.persist(this.message);
                   utx.commit();
                   returnValue = "success";
              } catch(Exception e) {
                   e.printStackTrace();
                   returnValue = "failure";
              return returnValue;
    }Relevant code from the faces-config.xml:
    <managed-bean>
         <managed-bean-name>MessageController</managed-bean-name>
         <managed-bean-class>my.package.MessageController</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
         <managed-property>
              <property-name>message</property-name>
              <property-class>my.package.Message</property-class>
              <value>#{Message}</value>
         </managed-property>
    </managed-bean>
    <managed-bean>
         <managed-bean-name>Message</managed-bean-name>
         <managed-bean-class>my.package.Message</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>This is my simple persistence.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0"
         xmlns="http://java.sun.com/xml/ns/persistence"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
        <persistence-unit name ="em1">
             <jta-data-source>jdbc/__glfish</jta-data-source>
        </persistence-unit>
    </persistence>The __glfish resource is all set up via Glassfish to point to my MySQL server, via a MySQLPool.
    Can anyone see what I'm doing wrong? The Message doesn't get added to the table in my database, and I get a NullPointerException in the method MessageController.save() on the property MessageController.message - which I have specified in the faces-config.xml. Shouldn't that be enough? What have I missed?

    Ok, I have (re-)located the problem. It's not my Message property which gets a NullPointerException - it seems like the problem is with my EntityManagerFactory instance. The PersistenceUnit don't get assigned, even though I declare it in my persistence.xml file.
    Maybe it is something wrong with my file structure?
    The .war file have this structure:
    - WEB-INF
         - classes
              - my
                   - package
                        Message.class
                        MessageController.class
         - lib
              [external jars goes here]
              - META-INF
                   persistence.xml
         faces-config.xml
         web.xml
    [*.jsp/*.xhtml goes here]Can anyone see what's wrong?

  • Toplink Essentials JPA doesn't use GenerationType.IDENTITY

    Based on EJB 3 and JPA I want to store some entities (@Entity) in a database. For some of those entites the database auto increments the primary key. In these cases I defined a @TableGenerator and a @GeneratedValue using GenerationType.IDENTITY as strategy in order to get the primary key (@Id) updated after the entity has been persisted.
    Short example:
    @Entity
    @Table(name = "orders")
    public class POrder implements PEntity {
         @TableGenerator(name = "orderIdGenerator", initialValue = 0, allocationSize = 1)
         @Id
         @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "orderIdGenerator")
         @Column(name = "orderNumber", nullable = false)
         private Integer orderNumber;
    ...I am running the application on GlassFish. I added a corresponding JDBC resource to the server configuration, using the specific MySql driver interfaces.
    Persisting entities which doesn't use a TableGenerator works, but as soon as I try to persist an entity which should use a TableGenerator I am running in the following exception:
    beergame.server.exception.BeergameServerException: nested exception is: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b55-fcs (10/10/2008))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'beergame3.sequence' doesn't exist
    Error Code: 1146
    Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
         bind => [1, roleIdGenerator]
    Query: DataModifyQuery()
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b55-fcs (10/10/2008))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'beergame3.sequence' doesn't exist
    Error Code: 1146
    Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
         bind => [1, roleIdGenerator]
    Query: DataModifyQuery()
         at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:311)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:654)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:703)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:492)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:452)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeCall(AbstractSession.java:690)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:214)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeNoSelectCall(DatasourceCallQueryMechanism.java:257)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeNoSelect(DatasourceCallQueryMechanism.java:237)
         at oracle.toplink.essentials.queryframework.DataModifyQuery.executeDatabaseQuery(DataModifyQuery.java:86)
         at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:628)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:1845)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
         at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:924)
         at oracle.toplink.essentials.sequencing.QuerySequence.update(QuerySequence.java:344)
         at oracle.toplink.essentials.sequencing.QuerySequence.updateAndSelectSequence(QuerySequence.java:283)
         at oracle.toplink.essentials.sequencing.StandardSequence.getGeneratedVector(StandardSequence.java:96)
         at oracle.toplink.essentials.sequencing.Sequence.getGeneratedVector(Sequence.java:281)
         at oracle.toplink.essentials.internal.sequencing.SequencingManager$Preallocation_Transaction_NoAccessor_State.getNextValue(SequencingManager.java:420)
         at oracle.toplink.essentials.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:846)
         at oracle.toplink.essentials.internal.sequencing.ClientSessionSequencing.getNextValue(ClientSessionSequencing.java:110)
         at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:240)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.assignSequenceNumber(UnitOfWorkImpl.java:355)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNotRegisteredNewObjectForPersist(UnitOfWorkImpl.java:3266)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:432)
         at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:3226)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.persist(EntityManagerImpl.java:221)
         at com.sun.enterprise.util.EntityManagerWrapper.persist(EntityManagerWrapper.java:440)
         at beergame.server.model.trans.impl.TExtensionOfPEntityImpl.persist(TExtensionOfPEntityImpl.java:130)
         at beergame.server.model.trans.impl.TRoleImpl.<init>(TRoleImpl.java:61)
         at beergame.server.logic.trans.impl.GameLogicImpl.assignUserToValueChainLevel(GameLogicImpl.java:81)
         at beergame.server.logic.remote.impl.UserSessionBean.createGame(UserSessionBean.java:65)
    I wonder why a sequence table has to be update whereas IDENTITY is defined as strategy. I tried also AUTO as strategy but it doesn' matter, the result is the same.
    I read several posts in forums, but couldn't find a solution. So I still have no idea how to get IDENTITY used as strategy. Any one of you does?
    My configuration:
    IDE: Eclipse 3.4.0
    Server: GlassFish V2 Java EE 5
    JPA Implementation: Toplink Essentials v2.1-b55
    JPA driver: oracle.toplink.essentials.PersistenceProvider
    Database: MySQL 5.0.51a
    JDBC driver: mysql-connector-java-5.1.5

    I did it. I must admit, I was a little bit confused by the annotation TableGenerator. It is not responsible for generating ids of a table at all but only in conjunction with a table which should provide ids.
    After I removed @TableGenerator and also the corresponding reference within @GeneratedValue the persistence works as expected. Now the code looks like this:
    @Entity
    @Table(name = "orders")
    public class POrder implements PEntity {
         @Id
         @GeneratedValue(strategy = GenerationType.IDENTITY)
         @Column(name = "orderNumber", nullable = false)
         private Integer orderNumber;
    ...Edited by: TomCat78 on Oct 12, 2008 3:38 PM

  • JPA persist() or merge()

    Hi All,
    I would like to get clarification between using JPA persist() and merge() where there is a OneToMany EMPLOYEE table unidirectionally joint to ManyToOne TELEPHONE table.
    The code snippet for OneToMany Employee.java entity object is as follows:
    @Entity
    @IdClass(EmployeePK.class)
    @Table(name="EMPLOYEE", catalog="CorporationDB", schema="")
    public class Employee implements Serializable {  
    @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER)
        @JoinTable(name="EMPLOYEE_TELEPHONE", catalog="CorporationDB", schema="",
                   joinColumns={@JoinColumn(name="FIRSTNAME", referencedColumnName="FIRSTNAME"),
                                @JoinColumn(name="SURNAME", referencedColumnName="SURNAME"),
                                @JoinColumn(name="AGE", referencedColumnName="AGE"),
                                @JoinColumn(name="SEX", referencedColumnName="SEX")},
                   inverseJoinColumns={@JoinColumn(name="TELEPHONE_ID")})
            private Collection<Telephone> telephones = new ArrayList<Telephone>();
        public Collection<Telephone> getTelephones()
         return telephones;
        public void setTelephones(Collection<Telephone> telephones)
         this.telephones = telephones;
        }The corresponding detail for ManyToOne Telephone.java entity object is:
    @Entity
    @Table(name="TELEPHONE", catalog="CorporationDB", schema="")
    public class Telephone implements Serializable {
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(name="ID")
        private int id;
        @Column(name="TELEPHONE")
        private String telephone;
        public void setTelephone(String telephone) {
            this.telephone = telephone;
        public String getTelephone() {
            return telephone;
        }I would like JPA to to ignore (not overwrite) existing record and only add newer unique telephone numbers. persist() does that except it is throwing the following exceptions and continually re-trying to insert the duplicate records:
    Local Exception Stack:
    *Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.DatabaseException*
    Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry Allan-Smith-20-M' for key 'PRIMARY'
    Error Code: 1062
    Call: INSERT INTO CorporationDB.EMPLOYEE (FIRSTNAME, SURNAME, AGE, SEX.....) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    *bind => [Allan, Smith, 20, M,....]*
    Query: InsertObjectQuery(finance.Employee@1d2d80c)
    JTS5054: Unexpected error occurred in after completion
    On the other hand, merge() ignores (does not add) duplicate Employee record (good) but it still duplicates the ManyToOne TELEPHONE table. Is it because of the OneToMany(cascade={CascadeType.ALL}} property in Employee.java which duplicates TELEPHONE records automatically? As a result, how to ensure that only unique OneToMany (EMPLOYEE) & ManyToOne (TELEPHONE) records are added once?
    persist() seems to work fine except that it is continually erroring out instead of skipping to the next new record.
    This Java EE 5 application is running properly.
    I am running JDK1.6.0_7, GF2.1 and MySQL on Windows XP.
    Thanks in advance,
    Jack

    I would recommend you continue to use TopLink Essentials as your JPA provider by setting your provider in your persistence.xml, or upgrading to EclipseLink and setting it as your provider. The latest WLS release also includes EclipseLink.
    James : http://www.eclipselink.org

  • Netbeans + MySQL + Tomcat (problem with: not a known entity type)

    I try to create WebApplication with Stripes in netbeans, but I have problem with connect to DB.
    I have this code:
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("jpaPU");
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    Person p = new Person();
    p.setFirstName("name1");
    p.setLastName("name2");
    try
    em.persist(p);
    } catch(Exception e)
    System.out.println(e.toString());
    em.getTransaction().commit();
    em.close();
    emf.close();But in try{..} is em.persist(p); ant it prints into console this error: "java.lang.IllegalArgumentException: Object: db_entity.Person@13c7c35 is not a known entity type."
    I do not know where is problem. Could you help me, please?
    This is my persistence.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
      <persistence-unit name="jpaPU" transaction-type="RESOURCE_LOCAL">
        <provider>oracle.toplink.essentials.PersistenceProvider</provider>
        <properties>
          <property name="toplink.jdbc.user" value="root"/>
          <property name="toplink.jdbc.password" value="adminadmin"/>
          <property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/test"/>
          <property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
          <property name="toplink.ddl-generation" value="create-tables"/>
        </properties>
      </persistence-unit>
    </persistence>When I run my application I can see in console:
    [TopLink Info]: 2008.11.15 09:01:13.265--ServerSession(4794542)--TopLink, version: Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))
    [TopLink Info]: 2008.11.15 09:01:13.578--ServerSession(4794542)--file:/D:/Workspace/NetBeansProjects/jpa/build/web/WEB-INF/classes/-jpaPU login successful..so, I hope persistence.xml is good
    This is my class Person.java:
    @Entity
    public class Person implements Serializable {
        @Id
        @GeneratedValue
        private Long id;
        private String firstName;
        private String lastName;
        public void setId(Long id) { this.id = id; }
        public Long getId() { return id; }
        public String getFirstName() {  return firstName; }
        public void setFirstName(String firstName) { this.firstName = firstName;  }
        public String getLastName() { return lastName; }
        public void setLastName(String lastName) { this.lastName = lastName;  }Please, help me.

    I had the same "is not a known entity type" error when running under a development environment Eclipse/Tomcat using Toplink. But the almost same code and configuration worked when running under Eclipse as a stand-alone Java app.
    Eventually I figured out (actually trial and error), that I had checked the toplink-essentials.jar libraries to be exported under: Eclipse Project/Java Build Path/Order and Export. I was messing around with libraries. Unchecking the export option there fixed the problem.
    While its unlikely that this could have been your exact problem, I would check the library order and export configurations. Looking at other message boards about this problem, many seemed to have been caused or fixed by playing with their libraries.

Maybe you are looking for

  • Messages waiting in the queue for long time.

    Hi Experts, We are having some Production issue - messages were waiting in the queue for long time and we found the errors in defaultTrace.12.trc file - Please help how to solve this issue its production and we need to move forward and solve this iss

  • Images gone from presentation, when replacing "image couldn't be inserted."

    Keynote 6.2, OSX 10.9.4, 1st gen Macbook Pro Retina I have a presentation that had a bunch of images that are now gone (replaced by the grey square with the "?"). When I open the presentation I get a "Some images are missing because they were deleted

  • WinXPHomeEdition -JRE autoinstall error -1.4.2_05

    hai, We are using the following code to download the JRE automatically. ============ <HTML> <BODY> Downloading Java WebStart... <OBJECT CODEBASE="http://java.sun.com/update/1.4.2/jinstall-1_4_2_05-windows-i586.cab" CLASSID="clsid:5852F5ED-8BF4-11D4-A

  • Java server and C# client

    Hallo, Please, Can you help me. I´m looking for Java server run on the Linux Debian. The Server in Java must be very good implementation (connect many client-500workstation). I have workstation ( Microsoft Windows XP, 7 ) and on the workstation must

  • Emsg/signal 11 and REP-3000 problems after tweaking a PDF/XML report

    Hello everyone, Just wanted to check if anyone has encountered similar issues? We have a custom rdf report installed by our Consultant/VAR, and is called / run from Oracle EBS using the Request Manager. This is an XML report that outputs a PDF file f