Hi All,
I have two tables account and address. I have two objects Address.java and
Account.java. I am populating the value from address table into Address.java
but keeping an instance of Address class in Account.java as "address". I
created the map statements and done all the configurations correctly. I have
two xml files both are included in the configuration file also. The map
statements are
// Account.xml
<result-map name="account-result" class="examples.domain.Account">
<property name="id" column="ACC_ID" />
<property name="firstName" column="ACC_FIRST_NAME"/>
<property name="lastName" column="ACC_LAST_NAME"/>
<property name="emailAddress" column="ACC_EMAIL"
null="[EMAIL PROTECTED]"/>
<property name="address" column="ACC_ID"
mapped-statement="getAddressForAccount" />
</result-map>
<mapped-statement name="getAccounts" cache-model="account-cache"
result-map="account-result">
select * from ACCOUNT
where ACC_ID = #value#
</mapped-statement>
//Address.xml
<mapped-statement name="getAddressForAccount"
result-class="examples.domain.Address">
select
ADR_ID as id,
ADR_DESCRIPTION as description,
ADR_STREET as street,
ADR_CITY as city,
ADR_PROVINCE as province,
ADR_POSTAL_CODE as postalCode
from ADDRESS
where ADR_ACC_ID = #value#
</mapped-statement>
The tables are
CREATE TABLE ACCOUNT (
ACC_ID INTEGER NOT NULL,
ACC_FIRST_NAME TEXT,
ACC_LAST_NAME TEXT,
ACC_EMAIL TEXT,
PRIMARY KEY (ACC_ID)
);
CREATE TABLE ADDRESS (
ADR_ID INTEGER NOT NULL,
ADR_ACC_ID INTEGER NOT NULL,
ADR_DESCRIPTION TEXT,
ADR_STREET TEXT,
ADR_CITY TEXT,
ADR_PROVINCE TEXT,
ADR_POSTAL_CODE TEXT,
PRIMARY KEY (ADR_ID)
);
The java statement is
List list = sqlMap.executeQueryForList("getAccounts", new Integer(1));
it is showing the error as
ERROR [main] - Error executing 'getAccounts' in
'examples/sqlmap/maps/Account.xml'. Check the Result Map. Check the
'address' property. Cause: java.sql.SQLException: No data found
java.sql.SQLException: No data found
at
com.ibatis.db.sqlmap.MappedStatement.runQueryForList(MappedStatement.java:67
7)
at
com.ibatis.db.sqlmap.MappedStatement.executeQueryForList(MappedStatement.jav
a:581)
at
com.ibatis.db.sqlmap.MappedStatement.executeQueryForList(MappedStatement.jav
a:561)
at com.ibatis.db.sqlmap.SqlMap.executeQueryForList(SqlMap.java:784)
at
examples.sqlmap.QueryForListExample.queryForListExample(QueryForListExample.
java:30)
at examples.sqlmap.QueryForListExample.main(QueryForListExample.java:66)
Exception : java.sql.SQLException: No data found
Can anybody please let me know about the actual problem that I am facing. I
need to do it in my realtime application and to move it in production. So
please let me know about the problem ASAP. I need the two different queries
from different tables combined in one Object.
Any help will be appreciable
Regards,
PRINCE V. K.
Regards,
PRINCE V. K.
Sr. Engineer (Software)
Desk No: 106, 1st Floor, E-Block, PKP
Airoli, New Mumbai - 708
Link Line: 9 625 6306
Mob: 9833855754
http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________
This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at [EMAIL PROTECTED] and delete this mail.
_____________________________________________________________________