2 Replies Latest reply on Dec 18, 2006 6:57 PM by jk;l jkl;

    What causes EntityExistsException?

    jk;l jkl; Expert

      What causes an EntityExistsException to be thrown from EntityManager's persist method?

      Is it anytime the database has a row with the same primary key? Or is it anytime the database has a row with any unique key being the same? Or do all fields have to be the same? Does it check existing entities in the persistence context that haven't necessarily yet been flushed to the database?

      Could somebody please explain what it takes for two entities (or rows in the database) to be seen as the same so as to throw an EntityExistsException (i.e. if they have some fields being the same, but not all)?