• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Modifying CMP entity bean definitions

 
Ranch Hand
Posts: 1419
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose we have an EJB application in production that uses CMP entity beans. A new requirement / enhancement / correction requires that we modify the entity bean definitions. This might involve adding new managed fields, removing a managed field, or whatever. The database schema must change. How is the database conversion performed?

With simple JDBC, one decides on a new schema and performs a database conversion (perhaps with the help of a DBA), and modifies the JDBC to refer to the new schema. But with CMP entity beans, the database and its schema are generated by the J2EE container!

I cannot imagine that the container could compare two versions of an application to deduce the SQL needed to convert the database, so I presume the conversion must be done manually. This means that we must know exactly the schema that would have been generated by the J2EE container, and change it ourselves. Or, perhaps, we would rename the tables generated by the first version, compare them to the tables generated by the new application, and figure out how to move the data from the old tables to the new tables.

In any case, it seems like a complicated ordeal, and I am surprised to have seen so little written about it.

What are your experiences in dealing with changes to CMP entity beans in a production application?
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suppose this all has to do with the ejb container you're using. If you had the server generate the database tables in the first place I suppose this could be a problem. I don't recall the "upgrade" of databases being a big feature, so I figure most won't do it. I'd go for trying to do it myself (ALTER TABLE, etc). Just make sure that you don't let your server delete the database/tables when it un-deploys the application before you do your upgrade!
 
Seriously? That's what you're going with? I prefer this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic