• 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

How do you add new CMP field to existing CMP with Sun Java Studio Ent?

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Sun Java Studio Enterprise 7 2004Q4 and Sun Application server 7.

Our database changed by adding one new field. I need to update the bean for that table.

I have no problem adding the new CMP field to the EJB, but I cannot get this new field mapped properly to the database. I cannot extend the existing schema; at least I havn't figured out how, and if I delete the schema and re-create it with the old name, then I get an error from the application server at runtime, saying the the configuration file for the class is invalid.

The schema exists. The field is in the new schema. The CMP field is in the bean. I mapped the new field the way I did all the others in the module. It compiles and deploys.

I did this once before but had to delete my beans and start over. I now have too many beans that are finalized to do that. It seems as though this tool only lets you create the schema once. Then you base your CMPs off that schema. No changes are allowed. There must be a way.

So what did I do wrong? How is adding a new CMP field supposed to be done? Is there an easier way to update the schema?

Any help will be greatly appreciated. Thank you.
 
Rusty Enisin
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. I found something that works, albeit I don't think it is the recommended way. But since I can't find a recommended way, I will settle for working.

1. Create a new schema under a different name.
2. Go to the module that has a bean that is using the old schema.
3. Find the reference for the bean under the module and look at the properties for the bean.
4. In the properties in the Sun Java System As section there is a property called Mapped Schema. Change it to the new schema.
5. deploy

There's more...

If you need to have the same name for the schema, like I did because I keep it in CVS, do this:
6. Shutdown the IDE
7. Go to the directory where the schema is and rename it to whatever you need (whatever you had originally).
8. restart the IDE
9. repeat steps 2-4
10. restart the IDE again before you deploy!

I know this is insane. But it is all I could figure out so far. If anybody has something else that is better, please, please, please let me know!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic