Hello,
* the class-descriptors:
<class-descriptor class="allibo.core.Account" table="c_account">
<field-descriptor name="account_id" column="account_id" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
<field-descriptor name="login" column="login" jdbc-type="VARCHAR"/>
<field-descriptor name="password" column="password" jdbc-type="VARCHAR"/>
<field-descriptor name="first_name" column="first_name" jdbc-type="VARCHAR"/>
<field-descriptor name="last_name" column="last_name" jdbc-type="VARCHAR"/>
<field-descriptor name="gender" column="gender" jdbc-type="VARCHAR"/>
<field-descriptor name="remark" column="remark" jdbc-type="VARCHAR"/>
<field-descriptor name="email" column="email" jdbc-type="VARCHAR"/>
<field-descriptor name="registration_date" column="registration_date" jdbc-type="DATE"/>
<field-descriptor name="last_activity_date" column="last_activity_date" jdbc-type="DATE"/>
<field-descriptor name="date_of_birth" column="date_of_birth" jdbc-type="DATE"/>
</class-descriptor>


<class-descriptor class="allibo.commerce.Employee" table="fem_employee">
<field-descriptor name="account_id" column="account_id" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
<reference-descriptor name="super" class-ref="allibo.core.Account" auto-retrieve="true" auto-update="true" auto-delete="true">
<foreignkey field-ref="account_id"/>
</reference-descriptor> </class-descriptor>


public class Account { public Organization organization;
public AccountAddress accountAddress;
private int account_id;
private String login;
private String password;
private String first_name;
private String last_name;
private String gender;
private String remark;
private String email;
private Date registration_date;
private Date last_activity_date;
private Date date_of_birth;
+ setter & getter methods


public class Employee extends Account {
private int account_id; private Account account;
+ setter & getter methods


* The code:
public void apply() {
//Query OJB Criteria crit = new Criteria();
logger.debug("login :" + login);
logger.debug("password :" + password);
crit.addEqualTo("login", login);
crit.addEqualTo("password", password); Query q = QueryFactory.newQuery(Employee.class, crit); try {
Collection results = broker.getCollectionByQuery(q);
Iterator it = results.iterator();
if (it.hasNext()) {
employee = (Employee) it.next();
logger.debug("First name " + employee.getFirst_name());
}
} catch (Throwable t) {
t.printStackTrace();
}
}


* The log
2063 [main] DEBUG allibo.commerce.UCFindEmployeeTest - employee :1082
2073 [main] INFO allibo.commerce.UCFindEmployeeTest - testApply
2073 [main] DEBUG allibo.commerce.UCFindEmployee - login :employee
2073 [main] DEBUG allibo.commerce.UCFindEmployee - password :employee
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.account_id FROM fem_employee A0 WHERE (login = ? ) AND password = ?
java.sql.SQLException: Column not found, message from server: "Unknown column 'login' in 'where clause'"
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: SQLException during the execution of the query (for a allibo.commerce.Employee): Column not found, message from server: "Unknown column 'login' in 'where clause'"
Column not found, message from server: "Unknown column 'login' in 'where clause'"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1626)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1844)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1458)
at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source)
at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown Source)
at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source)
at allibo.commerce.UCFindEmployee.apply(UCFindEmployee.java:58)
at allibo.commerce.UCFindEmployeeTest.testApply(UCFindEmployeeTest.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
java.sql.SQLException: Column not found, message from server: "Unknown column 'login' in 'where clause'"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1626)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1844)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1458)
at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source)
at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown Source)
at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source)
at allibo.commerce.UCFindEmployee.apply(UCFindEmployee.java:58)
at allibo.commerce.UCFindEmployeeTest.testApply(UCFindEmployeeTest.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
rethrown as org.apache.ojb.broker.PersistenceBrokerSQLException: Column not found, message from server: "Unknown column 'login' in 'where clause'"
at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source)
at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown Source)
at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source)
at allibo.commerce.UCFindEmployee.apply(UCFindEmployee.java:58)
at allibo.commerce.UCFindEmployeeTest.testApply(UCFindEmployeeTest.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
Caused by: java.sql.SQLException: Column not found, message from server: "Unknown column 'login' in 'where clause'"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1626)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1844)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1458)
... 26 more
rethrown as org.apache.ojb.broker.PersistenceBrokerException: Column not found, message from server: "Unknown column 'login' in 'where clause'"
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown Source)
at allibo.commerce.UCFindEmployee.apply(UCFindEmployee.java:58)
at allibo.commerce.UCFindEmployeeTest.testApply(UCFindEmployeeTest.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
Caused by: org.apache.ojb.broker.PersistenceBrokerSQLException: Column not found, message from server: "Unknown column 'login' in 'where clause'"
at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source)
at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown Source)
at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown Source)
... 20 more
Caused by: java.sql.SQLException: Column not found, message from server: "Unknown column 'login' in 'where clause'"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1626)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1844)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1458)
... 26 more


***Thank you***

Jakob Braeuchi wrote:

hi,

could you please post the sql used to search and the class-descriptors ?

jakob

balza wrote:

Hello,
I've
- table tA and tB with an inheritance relationship
- class B extending A
- class A reflect tA
- class B reflect tB
insert in class B generate an entry in table tA and in table tB
delete or search on table tB generate a "java.sql.SQLException: Column not found, message from server: "Unknown column 'xxx' in 'where clause'""


What's wrong?

Thank you





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to