Hi,
I have an application which needs to add the concrete classes to a ManyToAny relationship at runtime.  Below is the code I'm currently using to do this :
Code:
configuration = new AnnotationConfiguration().configure();
           SessionFactory tempSessionFactory = configuration.buildSessionFactory();
           
           HashMap<ImplicitPolymorphismVariable,List<ImplicitPolymorphismEntry>> implicitPolymorphisimMap = aplosContextListener.getImplicitPolymorphismMap();
           for( ImplicitPolymorphismVariable ipVariable : implicitPolymorphisimMap.keySet() ) {
               if( configuration.getClassMapping( ipVariable.getFullClassName() ) != null ) {
                  RootClass rootClass = configuration.getClassMapping( ipVariable.getFullClassName()  ).getRootClass();
                  Property hibernateProperty = rootClass.getProperty( ipVariable.getVariableName() );
                  
                  Any anyValue = null;
                  if( hibernateProperty.getValue() instanceof Any ) {
                      anyValue = (Any) hibernateProperty.getValue();
                  } else {
                     anyValue = (Any) ((org.hibernate.mapping.Map) hibernateProperty.getValue()).getElement();
                  }
           
                 Map metaMap = anyValue.getMetaValues();
                 if( metaMap == null ) {
                    metaMap = new HashMap();
                 }
                org.hibernate.type.Type metaType = TypeFactory.heuristicType( anyValue.getMetaType() );
                for( ImplicitPolymorphismEntry ipEntry : implicitPolymorphisimMap.get( ipVariable ) ) {
                   Object metaValue = ((DiscriminatorType) metaType).stringToObject( ipEntry.getClassIdentifier() );
                   Mappings mappings = configuration.createMappings();
                   String entityName = HbmBinder.getClassName( ipEntry.getFullClassName(), mappings );
                    metaMap.put( metaValue, entityName );
                }
               }
           }
          
           configuration.buildSessionFactory();
This all seems to work fine at first, it loads out the correct classes from the database and my application works.  However when I try to save the ManyToAny relationship it adds in a null value to the contentplaceholder_type field, could someone who works in the source code let me know the missing piece of this jigsaw?