Cascade or delete in database server, why if my EJB do it for me?

Hi,

I am in design phase of a database for my j2EE application. In the database desing i have some relationships entities, that have foreign keys. I have several options about foreign keys in the relationships, cascade deletes, restrict .... all in my database server.

But, when i am reading the referencial integrity of the entity EJBs CMP relationships, the entity beans make the cascade deletes automaticaly for maintain the relationsships.

Need i make my relationships in my database server with cascade delete options or leave it for my application server?

Another one, if i make relationships in my database server, why i need do it in my entity beans?

tanks, sorry for my poor english

[728 byte] By [kerulea] at [2007-11-26 21:37:05]
# 1

Hi Kerule,

you can leave the handling of relationships to the application server. Please do not use the cascade delete option in the database. CMP code handles cascade delete just fine.

Relationships established in the database will be there in your entity beans. But you should not update the database (the tables used by your application) from outside the application server while your application is running.

Regards,

-- markus.

m_fuchsa at 2007-7-10 3:19:03 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Hi Markus,

Tanks for your answer, if this tip only for entity beans with CMP?

For example, if i have some entity beans, one with CMP and other with JDO, or for example, an entity beans that use CMP and JDO for access to few tables (i dont know that it is possible or it a good design), how can i design the relationships update/delete cascades in my database server, all entity beans persistence types support his referencial integrity ? if this if true i think that i forget the relationships updates/deletes cascades in my database server.

At this moment, i dont know what type of persistence i will use in my application server. I dont undertand yet wath approach i must follow, i design my database and after design my entity beans over this database or i must foget my database and beging with entity beans design first .... i have a big problem, i need read a lot of more.

Something for help me?

Very, very thanks

kerulea at 2007-7-10 3:19:03 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...