Hello,
Using javax.persistence.MapKey with a one2many relation does not work, if I use a default schema name. the schema name is ignored when selecting the map column value with a subquery.
See the code below. my default schema was named annotation.
I suppose this is bug.
Best Regards
Sebastian Hennebrüder
Hibernate version: 
hibernate-annotations-3.3.0.GA
Mapping documents:
Code:
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.MapKey;
import javax.persistence.OneToMany;
@Entity
public class Beach implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;
    private String name;
    @MapKey(name = "isoCode")
    @OneToMany
    private Map<String, Country> countries = new HashMap<String, Country>();
Code:
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="tcountry")
public class Country implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;
    private String isoCode;
    private String name;
Code between sessionFactory.openSession() and session.close():Code:
List<Beach> beaches = session.createCriteria(Beach.class).list();
   for (Beach beach : beaches) {
       System.out.println(beach);
       for (String key : beach.getCountries().keySet()) {
      System.out.println(MessageFormat.format("{0} = {1}", new Object[] { key,
         beach.getCountries().get(key) }));
       }
   }
Full stack trace of any exception that occurs:Code:
4:32:15,492 ERROR JDBCExceptionReporter:78 - FEHLER: Relation »tcountry« existiert nicht
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not initialize a collection: [de.laliluna.other.mapkey.Beach.countries#2]
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.loader.Loader.loadCollection(Loader.java:1992)
   at org.hibernate.loader.collection.BatchingCollectionInitializer.initialize(BatchingCollectionInitializer.java:52)
   at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
   at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
   at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
   at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
   at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
   at org.hibernate.collection.PersistentMap.keySet(PersistentMap.java:226)
Name and version of the database you are using:The generated SQL (show_sql=true):Code:
select countries0_.Beach_id as Beach1_1_, countries0_.countries_id as countries2_1_, 
(select a7.isoCode from tcountry a7 
where a7.id=countries0_.countries_id) as formula1_1_, 
country1_.id as id66_0_, country1_.isoCode as isoCode66_0_, country1_.name as name66_0_ 
from annotation.Beach_tcountry countries0_ 
left outer join annotation.tcountry country1_ on countries0_.countries_id=country1_.id where countries0_.Beach_id=?
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this: 
http://hibernate.org/42.html