Search code examples
ormdb2zos

Do any ORM frameworks allow choreography of multiple database inserts


I have a requirement to perform the following steps (stages/phases) when updating my database.

  1. Validate business request to ensure it is valid.
  2. Identify what database records need creating.
  3. Create these records as Java Objects, populated with the necessary instance variable values.
  4. Persist multiple records in the required sequence (e.g. Parent(s) then Child(ren)) within one transaction.
  5. Repeat process for next Business request.

My entire database consists of over 600 tables. Some business requests result in 30 to 40 tables requiring new data to be inserted. I am looking for a process where i can instantiate all my Java entity objects, populate them with the required data. Then

  • Begin Transaction,
  • choreograph inserts,
  • commit.

am i going to have to be the choreographer? My database is IBM db2 v10 for z/os. My development environment is Java 7, IBM Websphere Application Server v8.5.5


Solution

  • z/OS has a built in transaction manager, RRS. You can use it as your transaction manager. I think you do automatically if you connect via WAS, but I'm not that familiar with it, so I can't say for sure. I'd suggest looking at the "DB2 for z/OS and WebSphere Integration for Enterprise Java Applications" redbook, here: http://books.google.com/books?id=UfjHAgAAQBAJ&pg=PA589&dq=DB2+for+z/OS+and+WebSphere+Integration+for+Enterprise+Java+Applications+redbook&hl=en&sa=X&ei=luypU82THI6uyAT7pIGgDQ&ved=0CDcQ6AEwAA#v=onepage&q=DB2%20for%20z%2FOS%20and%20WebSphere%20Integration%20for%20Enterprise%20Java%20Applications%20redbook&f=false