Hello,
I have a simple unit test class :
public static String id;
public AppointmentDelegateTest(String arg0)
throws Exception
{
super(arg0);
Appointment appointment = new Appointment();
User user = new User();
appointment.setUser(user);
appointment.setCreationDate( new java.util.Date() );
appointment.put();
GenericDelegate.getInstance().clearCache();
id = appointment.getId().toString();
}
PersistenceBroker broker ;
protected void setUp() throws Exception
{
super.setUp();
try{
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
}
catch (PBFactoryException e)
{
}
protected void tearDown() throws Exception
{
super.tearDown();
broker.close();
}
public void testGetAppointment()
throws Exception
{
Criteria criteria = new Criteria();
criteria.addEqualTo("id", new Integer(id));
Query q = QueryFactory.newQuery( Appointment.class , criteria);
Appointment appointment = (Appointment) broker.getObjectByQuery(q);
assertNotNull( appointment );
}
---------------------------
the sql debug output =
-------------------------
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:INSERT INTO Appointment
(longdescription,noofattachement,shortdescription,userid,totime,fromtime,id,
creationdate,location) VALUES (?,?,?,?,?,?,?,?,?)
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Contact WHERE appointmentId=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Contact WHERE appointmentId=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Contact WHERE appointmentId=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Contact WHERE appointmentId=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Contact WHERE appointmentId=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Contact WHERE appointmentId=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Contact WHERE appointmentId=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Contact WHERE appointmentId=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Contact WHERE appointmentId=?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=?
.......[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl]
DEBUG: SQL:SELECT
A0.userid,A0.longdescription,A0.totime,A0.fromtime,A0.location,A0.noofattach
ement,A0.creationdate,A0.id,A0.shortdescription FROM Appointment A0 WHERE
A0.id = ?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT password,logname,usercontactid,id FROM User WHERE id = ?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
Result of getTableAlias(): null
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
Result of getTableAlias(): null
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
Result of getTableAlias(): null
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
Result of getTableAlias(): null
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT
A0.gender,A0.phone,A0.mailheader,A0.title,A0.type,A0.function,A0.privat,A0.m
ailfooter,A0.id,A0.mobilephone,A0.companyid,A0.lastname,A0.userid,A0.middlen
ame,A0.searchname,A0.firstname,A0.online,A0.dateofbirth,A0.initials,A0.email
,A0.creationdate FROM Contact A0,Appointment2Contact WHERE
(Appointment2Contact.appointmentId = ?) AND Appointment2Contact.contactId =
A0.id
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
Result of getTableAlias(): null
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
Result of getTableAlias(): null
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
Result of getTableAlias(): null
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
Result of getTableAlias(): null
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT A0.originalfilename,A0.filename,A0.id FROM Attachement
A0,Appointment2Attachement WHERE (Appointment2Attachement.appointmentid = ?)
AND Appointment2Attachement.attachementId = A0.id
My question is why it contains so many delete staments and why i see
suddenly Result of getTableAlias(): null. I did not see this in rc6. It is
not giving trouble but it looks strange to me.
the appointment descriptor =
<class-descriptor class="nl.salesmakers.model.Appointment"
table="Appointment">
<field-descriptor id="18" name="longDescription" column="longdescription"
jdbc-type="LONGVARCHAR"/>
<field-descriptor id="19" name="noOfAttachement" column="noofattachement"
jdbc-type="INTEGER"/>
<field-descriptor id="20" name="shortDescription" column="shortdescription"
jdbc-type="VARCHAR"/>
<field-descriptor id="22" name="userId" column="userid"
jdbc-type="INTEGER"/>
<field-descriptor id="23" name="toTime" column="totime"
jdbc-type="TIMESTAMP"/>
<field-descriptor id="24" name="fromTime" column="fromtime"
jdbc-type="TIMESTAMP"/>
<field-descriptor id="25" name="id" column="id" jdbc-type="INTEGER"
primarykey="true" autoincrement="true"/>
<field-descriptor id="26" name="creationDate" column="creationdate"
jdbc-type="DATE"/>
<reference-descriptor name="user" class-ref="nl.salesmakers.model.User">
<foreignkey field-ref="userId"/>
</reference-descriptor>
<collection-descriptor name="contactList"
element-class-ref="nl.salesmakers.model.Contact" auto-retrieve="true"
auto-update="true" auto-delete="false"
indirection-table="Appointment2Contact">
<fk-pointing-to-this-class column="appointmentId"/>
<fk-pointing-to-element-class column="contactId"/>
</collection-descriptor>
<collection-descriptor name="attachementList"
element-class-ref="nl.salesmakers.model.AttacheMent" auto-retrieve="true"
auto-update="true" auto-delete="false"
indirection-table="Appointment2Attachement">
<fk-pointing-to-this-class column="appointmentid"/>
<fk-pointing-to-element-class column="attachementId"/>
</collection-descriptor>
<field-descriptor name="location" column="location" jdbc-type="VARCHAR"/>
</class-descriptor>
thanks,
Dennis
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]