Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » validate unique column before commit(validate unique column before commit)
validate unique column before commit [message #1023670] Sun, 24 March 2013 22:30 Go to next message
salah oukoud is currently offline salah oukoud
Messages: 1
Registered: March 2013
Junior Member
hello

i want to validate my entity in persiste function, before commit transaction!

can you help me please !

code :
try {
            EntityManagerFactory emf = Persistence.createEntityManagerFactory("Certif_Resid_DAO");
            ProfessionJpaController controller = new ProfessionJpaController(emf);
            Profession profession = new Profession("titi"); // "titi" :name of profession with name is unique
            
            controller.create(profession); //insert into entitymanager
            controller.create(profession); // here insert will be throw an exception before commit to database
            
            assertTrue(true);

        } catch (Exception e) {
            fail(e.getMessage());
        }
Re: validate unique column before commit [message #1027063 is a reply to message #1023670] Tue, 26 March 2013 14:13 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

What is your problem/question?


James : Wiki : Book : Blog : Twitter
Previous Topic:metamodel with two data sources using annotations
Next Topic:Aggregated objects cannot be written/deleted/queried independently from their owners
Goto Forum:
  


Current Time: Mon Oct 20 18:11:33 GMT 2014

Powered by FUDForum. Page generated in 1.20614 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software