[jboss-user] [EJB/JBoss] - Relations not working properly!!!
wilkowskim
do-not-reply at jboss.com
Wed Jul 12 02:28:14 EDT 2006
Hello,
I have the following problem. I have to beans AkcjaBean (which translates to English as ActionBean) and ScenaBean (which translates to SceneBean). One AkcjaBean contains many ScenaBean.
Generally the application is working fine. However, after a few hours (mostly 4-5) the server "mixes" the relation and one AkcjaBean instance contains invalid ScenaBean's which are actually (according to the database) contained by other instance of AkcjaBean. We made investigations and found in server.log that JDBCLoadRelationCommand is not called in that case (seems like JBoss is cache'ing the relation). I have the following questions:
1. what I am doing wrong?
2. how I can turn off cache'ing the relation and make JBoss call JDBCLoadRelationCommand.
Please help as quickly as you can.
Below are the key parts of AkcjaBean file (we use xdoclet for generation):
/** @ejb:pk-field
*
* @ejb:interface-method view-type="local"
* @ejb:persistent-field
*
* @ejb.persistence column-name="akcja_id"
* jdbc-type="NUMERIC"
*/
public abstract Integer getAkcja_id();
/** @ejb:persistent-field */
public abstract void setAkcja_id(Integer akcja_id);
/** @ejb:interface-method view-type="local"
* @ejb:persistent-field
* @ejb.persistence column-name="nazwa"
* jdbc-type="VARCHAR"
* @resin-ejb.cmp-field sql-column="nazwa"
*
*/
/**
* @ejb.interface-method view-type = "local"
* @ejb.relation name = "akcja-scena"
* role-name = "akcja zawiera sceny"
*
* @return kolekcja scen
*/
public abstract Collection getSceny();
/**
* @ejb.interface-method view-type = "local"
* @param kolekcja scen
*/
public abstract void setSceny(Collection sceny);
/** @ejb:interface-method view-type="local"
* @ejb:persistent-field
* @ejb.persistence column-name="ftp_user"
* jdbc-type="VARCHAR2"
*/
Below are the key parts of the ScenaBean class:
/**
* @ejb.create-method
* @param id
* @param akcja
* @param nazwa
* @param q_id
* @param pozycja
* @param user_id
* @return
* @throws CreateException
*/
public Integer ejbCreate(Integer id, AkcjaLocal akcja, String nazwa, Integer q_id,
Integer pozycja, Integer user_id, Integer profil_id, Integer start_s) throws CreateException {
setId(id);
setNazwa(nazwa);
setQ_id(q_id);
setPozycja(pozycja);
setProfil_id(profil_id);
GregorianCalendar gc = (GregorianCalendar) GregorianCalendar.getInstance();
Timestamp t = new Timestamp(gc.getTimeInMillis());
setData_modyfikacji(t);
setData_utworzenia(t);
setUser_id(user_id);
setAutor_id(user_id);
if (akcja!=null)
setAkcja_id(akcja.getAkcja_id());
setStart_s(start_s);
return id;
}
public Integer ejbPostCreate(Integer id, AkcjaLocal akcja, String nazwa, Integer q_id,
Integer pozycja, Integer user_id, Integer start_s) throws CreateException {
setAkcja(akcja);
return id;
}
/**
* @ejb.interface-method view-type = "local"
* @ejb.relation name = "akcja-scena"
* role-name = "scena zawiera sie w akcji"
* cascade-delete="yes"
*
* @jboss.relation related-pk-field = "akcja_id"
* fk-column = "akcja_id"
* fk-constraint = "true"
*
*
* @return kolekcja scen
*/
public abstract AkcjaLocal getAkcja();
/**
* @ejb.interface-method view-type = "local"
* @param kolekcja scen
*/
public abstract void setAkcja(AkcjaLocal akcja);
/** @ejb:interface-method view-type="local"
* @ejb:persistent-field
* @ejb.persistence column-name="nazwa"
* jdbc-type="VARCHAR"
* @resin-ejb.cmp-field sql-column="nazwa"
*/
I don't want to spam forum so I will send the entire classes and the client code with comments only to interested recipients.
Regards
Michal
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957237#3957237
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957237
More information about the jboss-user
mailing list