Hibernate version:
Hibernate 3.0
Mapping documents:
CXI_CON_EXTENDED_INFO
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.xxx.clients.xxx.xxx.model.CxiConExtendedInfo" table="CXI_CON_EXTENDED_INFO" schema="VWS_OWNER">
<id name="cxiConCode" type="java.lang.String">
<column name="CXI_CON_CODE" length="30" />
<generator class="sequence" />
</id>
<property name="cxiCgrlLk" type="java.lang.String">
<column name="CXI_CGRL_LK" length="30" />
</property>
<property name="cxiBmlCode" type="java.lang.String">
<column name="CXI_BML_CODE" length="30" />
</property>
<property name="cxiStartDate" type="java.util.Date">
<column name="CXI_START_DATE" length="7" />
</property>
<property name="cxiEndDate" type="java.util.Date">
<column name="CXI_END_DATE" length="7" />
</property>
<property name="cxiIreCareer" type="java.lang.String">
<column name="CXI_IRE_CAREER" length="4000" />
</property>
<property name="cxiOtherCareer" type="java.lang.String">
<column name="CXI_OTHER_CAREER" length="4000" />
</property>
<property name="cxiSpecialisations" type="java.lang.String">
<column name="CXI_SPECIALISATIONS" length="4000" />
</property>
<property name="cxiKeyAchievements" type="java.lang.String">
<column name="CXI_KEY_ACHIEVEMENTS" length="4000" />
</property>
<property name="cxiOtherSkills" type="java.lang.String">
<column name="CXI_OTHER_SKILLS" length="4000" />
</property>
<property name="cxiUniversities" type="java.lang.String">
<column name="CXI_UNIVERSITIES" length="4000" />
</property>
<property name="cxiQualifications" type="java.lang.String">
<column name="CXI_QUALIFICATIONS" length="4000" />
</property>
<property name="cxiMemberships" type="java.lang.String">
<column name="CXI_MEMBERSHIPS" length="4000" />
</property>
<property name="cxiManagerConCode" type="java.lang.String">
<column name="CXI_MANAGER_CON_CODE" length="30" />
</property>
<property name="cxiSecretaryConCode" type="java.lang.String">
<column name="CXI_SECRETARY_CON_CODE" length="30" />
</property>
<property name="cxiPhotographUrl" type="java.lang.String">
<column name="CXI_PHOTOGRAPH_URL" length="600" />
</property>
<property name="cxiCvUrl" type="java.lang.String">
<column name="CXI_CV_URL" length="600" />
</property>
<property name="cxiCgrlCode" type="java.lang.String">
<column name="CXI_CGRL_CODE" length="30" />
</property>
<property name="cxiClientsWorkedFor" type="java.lang.String">
<column name="CXI_CLIENTS_WORKED_FOR" length="4000" />
</property>
<many-to-one name="ConContact" class="com.xxx.clients.xxx.xxx.model.ConContact" update="false" insert="false" fetch="select">
<column name="conCode" not-null="true" unique="true" />
</many-to-one>
</class>
</hibernate-mapping>
CON_CONTACT
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.xxx.clients.xxx.xxx.model.ConContact" table="PFIC_PEOPLEFINDER_INTERNAL_CON" schema="DATA_OWNER">
<id name="conCode" type="java.lang.String">
<column name="CON_CODE" length="60" />
</id>
<property name="conAlternativeContact" type="java.lang.String">
<column name="CON_ALTERNATIVE_CONTACT" length="300" />
</property>
<property name="conBllCode" type="java.lang.String">
<column name="CON_BLL_CODE" length="60" />
</property>
<property name="conCreatedBy" type="java.lang.String">
<column name="CON_CREATED_BY" length="90" />
</property>
<property name="conDateCreated" type="java.util.Date">
<column name="CON_DATE_CREATED" length="7" />
</property>
<property name="conDateModified" type="java.util.Date">
<column name="CON_DATE_MODIFIED" length="7" />
</property>
<property name="conDdi" type="java.lang.String">
<column name="CON_DDI" length="300" />
</property>
<property name="conDepCode" type="java.lang.String">
<column name="CON_DEP_CODE" length="60" />
</property>
<property name="conEmail" type="java.lang.String">
<column name="CON_EMAIL" length="300" />
</property>
<property name="conExtNo" type="java.lang.String">
<column name="CON_EXT_NO" length="60" />
</property>
<property name="conFamiliarName" type="java.lang.String">
<column name="CON_FAMILIAR_NAME" length="720" />
</property>
<property name="conFax" type="java.lang.String">
<column name="CON_FAX" length="60" />
</property>
<property name="conFirstName" type="java.lang.String">
<column name="CON_FIRST_NAME" length="300" />
</property>
<property name="conGlobalId" type="java.lang.Long">
<column name="CON_GLOBAL_ID" precision="22" scale="0" />
</property>
<property name="conHomeFax" type="java.lang.String">
<column name="CON_HOME_FAX" length="150" />
</property>
<property name="conHomePhone" type="java.lang.String">
<column name="CON_HOME_PHONE" length="150" />
</property>
<property name="conInitials" type="java.lang.String">
<column name="CON_INITIALS" length="24" />
</property>
<property name="conInternalEmployee" type="java.lang.String">
<column name="CON_INTERNAL_EMPLOYEE" length="3" />
</property>
<property name="conIreConCode" type="java.lang.String">
<column name="CON_IRE_CON_CODE" length="60" />
</property>
<property name="conJobTitle" type="java.lang.String">
<column name="CON_JOB_TITLE" length="150" />
</property>
<property name="conMobile" type="java.lang.String">
<column name="CON_MOBILE" length="60" />
</property>
<property name="conModifiedBy" type="java.lang.String">
<column name="CON_MODIFIED_BY" length="90" />
</property>
<property name="conNotesHeader" type="java.lang.String">
<column name="CON_NOTES_HEADER" length="180" />
</property>
<property name="conNotCode" type="java.lang.String">
<column name="CON_NOT_CODE" length="60" />
</property>
<property name="conNtUser" type="java.lang.String">
<column name="CON_NT_USER" length="384" />
</property>
<property name="conOffCode" type="java.lang.String">
<column name="CON_OFF_CODE" length="60" />
</property>
<property name="conOrgCode" type="java.lang.String">
<column name="CON_ORG_CODE" length="60" />
</property>
<property name="conPllCode" type="java.lang.String">
<column name="CON_PLL_CODE" length="60" />
</property>
<property name="conPreviousSurname" type="java.lang.String">
<column name="CON_PREVIOUS_SURNAME" length="720" />
</property>
<property name="conSecondaryEmail" type="java.lang.String">
<column name="CON_SECONDARY_EMAIL" length="300" />
</property>
<property name="conStaffId" type="java.lang.Long">
<column name="CON_STAFF_ID" precision="22" scale="0" />
</property>
<property name="conSuffix" type="java.lang.String">
<column name="CON_SUFFIX" length="120" />
</property>
<property name="conSurname" type="java.lang.String">
<column name="CON_SURNAME" length="720" />
</property>
<property name="conTeam" type="java.lang.String">
<column name="CON_TEAM" length="300" />
</property>
<property name="conTitle" type="java.lang.String">
<column name="CON_TITLE" length="60" />
</property>
<property name="conUsercode" type="java.lang.String">
<column name="CON_USERCODE" length="765" />
</property>
<property name="conUserid" type="java.lang.String">
<column name="CON_USERID" length="150" />
</property>
<property name="conWwwLink" type="java.lang.String">
<column name="CON_WWW_LINK" length="300" />
</property>
<property name="conEnglishName" type="java.lang.String">
<column name="CON_ENGLISH_NAME" length="4000" />
</property>
<property name="conEnglishPrename" type="java.lang.String">
<column name="CON_ENGLISH_PRENAME" length="4000" />
</property>
<property name="conOrder1" type="java.lang.String">
<column name="CON_ORDER_1" length="4000" />
</property>
<property name="conOrder2" type="java.lang.String">
<column name="CON_ORDER_2" length="4000" />
</property>
<property name="conDeskFloor" type="java.lang.String">
<column name="CON_DESK_FLOOR" length="24" />
</property>
<set name="cxiConExtendedInfos" inverse="true">
<key>
<column name="cxiConCode" not-null="true" unique="true" />
</key>
<one-to-many class="com.xxx.clients.xxx.xxx.model.CxiConExtendedInfo" />
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
public boolean testSearch(){
Session session = getSession();
try {
Criteria criteria = session.createCriteria(ConContact.class);
criteria.add(Restrictions.ilike("conFirstName", "Z", MatchMode.ANYWHERE));
criteria.add(Restrictions.ilike("conSurname", "Z", MatchMode.ANYWHERE));
Criteria criteria2 = criteria.createCriteria("cxiConExtendedInfos");
criteria2.add(Restrictions.isNull("cxiEndDate"));
List list = criteria2.list();
for (Iterator iter = list.iterator(); iter.hasNext();) {
ConContact element = (ConContact) iter.next();
System.out.println(element.getConFirstName());
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
Full stack trace of any exception that occurs:Name and version of the database you are using:Code:
Oracle 10.1
The generated SQL (show_sql=true):Code:
Hibernate:
select
this_.CON_CODE as CON1_10_1_,
this_.CON_ALTERNATIVE_CONTACT as CON2_10_1_,
this_.CON_BLL_CODE as CON3_10_1_,
this_.CON_CREATED_BY as CON4_10_1_,
this_.CON_DATE_CREATED as CON5_10_1_,
this_.CON_DATE_MODIFIED as CON6_10_1_,
this_.CON_DDI as CON7_10_1_,
this_.CON_DEP_CODE as CON8_10_1_,
this_.CON_EMAIL as CON9_10_1_,
this_.CON_EXT_NO as CON10_10_1_,
this_.CON_FAMILIAR_NAME as CON11_10_1_,
this_.CON_FAX as CON12_10_1_,
this_.CON_FIRST_NAME as CON13_10_1_,
this_.CON_GLOBAL_ID as CON14_10_1_,
this_.CON_HOME_FAX as CON15_10_1_,
this_.CON_HOME_PHONE as CON16_10_1_,
this_.CON_INITIALS as CON17_10_1_,
this_.CON_INTERNAL_EMPLOYEE as CON18_10_1_,
this_.CON_IRE_CON_CODE as CON19_10_1_,
this_.CON_JOB_TITLE as CON20_10_1_,
this_.CON_MOBILE as CON21_10_1_,
this_.CON_MODIFIED_BY as CON22_10_1_,
this_.CON_NOTES_HEADER as CON23_10_1_,
this_.CON_NOT_CODE as CON24_10_1_,
this_.CON_NT_USER as CON25_10_1_,
this_.CON_OFF_CODE as CON26_10_1_,
this_.CON_ORG_CODE as CON27_10_1_,
this_.CON_PLL_CODE as CON28_10_1_,
this_.CON_PREVIOUS_SURNAME as CON29_10_1_,
this_.CON_SECONDARY_EMAIL as CON30_10_1_,
this_.CON_STAFF_ID as CON31_10_1_,
this_.CON_SUFFIX as CON32_10_1_,
this_.CON_SURNAME as CON33_10_1_,
this_.CON_TEAM as CON34_10_1_,
this_.CON_TITLE as CON35_10_1_,
this_.CON_USERCODE as CON36_10_1_,
this_.CON_USERID as CON37_10_1_,
this_.CON_WWW_LINK as CON38_10_1_,
this_.CON_ENGLISH_NAME as CON39_10_1_,
this_.CON_ENGLISH_PRENAME as CON40_10_1_,
this_.CON_ORDER_1 as CON41_10_1_,
this_.CON_ORDER_2 as CON42_10_1_,
this_.CON_DESK_FLOOR as CON43_10_1_,
cxiconexte1_.CXI_CON_CODE as CXI1_22_0_,
cxiconexte1_.CXI_CGRL_LK as CXI2_22_0_,
cxiconexte1_.CXI_BML_CODE as CXI3_22_0_,
cxiconexte1_.CXI_START_DATE as CXI4_22_0_,
cxiconexte1_.CXI_END_DATE as CXI5_22_0_,
cxiconexte1_.CXI_IRE_CAREER as CXI6_22_0_,
cxiconexte1_.CXI_OTHER_CAREER as CXI7_22_0_,
cxiconexte1_.CXI_SPECIALISATIONS as CXI8_22_0_,
cxiconexte1_.CXI_KEY_ACHIEVEMENTS as CXI9_22_0_,
cxiconexte1_.CXI_OTHER_SKILLS as CXI10_22_0_,
cxiconexte1_.CXI_UNIVERSITIES as CXI11_22_0_,
cxiconexte1_.CXI_QUALIFICATIONS as CXI12_22_0_,
cxiconexte1_.CXI_MEMBERSHIPS as CXI13_22_0_,
cxiconexte1_.CXI_MANAGER_CON_CODE as CXI14_22_0_,
cxiconexte1_.CXI_SECRETARY_CON_CODE as CXI15_22_0_,
cxiconexte1_.CXI_PHOTOGRAPH_URL as CXI16_22_0_,
cxiconexte1_.CXI_CV_URL as CXI17_22_0_,
cxiconexte1_.CXI_CGRL_CODE as CXI18_22_0_,
cxiconexte1_.CXI_CLIENTS_WORKED_FOR as CXI19_22_0_
from
DATA_OWNER.PFIC_PEOPLEFINDER_INTERNAL_CON this_
inner join
VWS_OWNER.CXI_CON_EXTENDED_INFO cxiconexte1_
on this_.CON_CODE=cxiconexte1_.cxiConCode
where
lower(this_.CON_FIRST_NAME) like ?
and lower(this_.CON_SURNAME) like ?
and cxiconexte1_.CXI_END_DATE is null
Debug level Hibernate log excerpt:Code:
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2148)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1533)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at org.hibernate.impl.CriteriaImpl$Subcriteria.list(CriteriaImpl.java:458)
at com.xxx.clients.xxx.xxx.dao.impl.ConContactDAO.testSearch(ConContactDAO.java:92)
at com.xxx.clients.xxx.util.StringTest.testString(StringTest.java:19)
at com.xxx.clients.xxx.util.StringTest.main(StringTest.java:14)
Caused by: java.sql.SQLException: ORA-00904: "CXICONEXTE1_"."CXICONCODE": invalid identifier
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1037)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1132)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3361)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
... 9 more
When I use Criteria, over a Join of Two tables, I get an exception 'invalid identifier'.
When I use a simple select findById() on the CXI_CON_EXTENDED_INFO, I get the results....
Can anybody please help?
Regards,
Shardul.