[jboss-user] How to avoid useless SQL-Statement when setting CMR-Field in ejbPostCreate

Sebastian Roth s.roth at mp-newmedia.com
Wed Aug 16 12:18:38 EDT 2006


Hi guys,

I hope someone can help me with that.

 

I use JBOSS 4.0.4GA.I have two Entities which have an 1:N RelationShip.

 

In my ejbPostCreate I set the CMR fields. 

 

public void ejbPostCreate(Integer rank, LocalAdMaterial adMaterial,
LocalAdLoc adLoc, LocalAdActionType adActionType) throws CreateException
{

            setAdMaterial(adMaterial);

            setAdActionType(adActionType);

            setAdLoc(adLoc);

      }

 

In the SQL-Logs I recognized that before each set-method the container
does a select on the table to which the CMR-Field link to.

 

2006-08-16 17:21:45,081 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.AdMaterial]
Executing SQL: SELECT ID, NAME, STATUS, ISO_CODE, DESCRIPTION,
AD_FORMAT, AD_CAMPAIGN FROM AD_MATERIAL WHERE (ID=?)

2006-08-16 17:21:45,097 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.AdActionType]
Executing SQL: SELECT NAME FROM AD_ACTION_TYPE WHERE (ID=?)

2006-08-16 17:21:45,112 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.AdLoc] Executing
SQL: SELECT ID, ERLAUBT_TYP, AVG_TCP, AD_PARTNER, AD_CHANEL, AD_WEBSITE,
AD_FORMAT FROM AD_LOC WHERE (ID=?)

2006-08-16 17:21:45,128 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.AdActionTracking]
Executing SQL: UPDATE AD_ACTION_TRACKING SET AD_LOC=?, AD_MATERIAL=?,
AD_ACTION_TYPE=? WHERE ID=?

 

 

I do not know why these SELECT statements are executed. Is this a normal
behaviour?

Can please someone help me to avoid these useless SQLs.

 

Thanks and regards,

Sebastian

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20060816/1322aea2/attachment.html 


More information about the jboss-user mailing list