| I am using Hibernate 2.1.3 with Oracle 9i
 I am getting a net.sf.hibernate.MappingException: No persister for: java.lang.String
 
 Here is the mapping file:
 ----------------------------
 
 <?xml version="1.0"?>
 <!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD//EN"
 "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
 
 <hibernate-mapping>
 <class name="com.amg.condenet.ad.domain.AdSuppression" table="AD_SUPPRESSION" mutable="false">
 <composite-id>
 <key-property name="mbid"      column="mbid"      type="string" />
 <key-property name="placement" column="placement" type="java.lang.string" />
 </composite-id>
 </class>
 </hibernate-mapping>
 
 Here is the code:
 -------------------
 Query query =
 session.createQuery("select count(*) from
 com.amg.condenet.ad.domain.AdSuppression adSuppression " +
 "WHERE adSuppression.mbid =? AND adSuppression.placement =?");
 
 query.setEntity(0, mbid);
 query.setEntity(1, placement);
 query.setMaxResults(1);
 
 int count = ((Integer) query.iterate().next()).intValue();
 
 ----------------------
 
 The interesting thing is that if I change the query definition to the following and remove the query.setEntity statements, it works fine:
 
 Query query =
 session.createQuery("select count(*) from
 com.amg.condenet.ad.domain.AdSuppression adSuppression " +
 "WHERE adSuppression.mbid = '" + mbid + "'  AND
 adSuppression.placement = '" + placement + "'");
 
 
 Any thoughts?
 
 
 |