Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
[b]Hibernate version: 3.x
[b]Mapping documents: -- 
[b]Code between sessionFactory.openSession() and session.close(): --
[b]Full stack trace of any exception that occurs:
Caused by: javax.faces.el.EvaluationException: org.springframework.dao.DataInteg
rityViolationException: not-null property references a null or transient value:
com.ericsson.cpm.batch.ProcessedParameterType._processedParameterTypesBackref; n
ested exception is org.hibernate.PropertyValueException: not-null property refer
ences a null or transient value: com.ericsson.cpm.batch.ProcessedParameterType._
processedParameterTypesBackref
[b]Name and version of the database you are using:
Sybase
[b]The generated SQL (show_sql=true): --
[b]Debug level Hibernate log excerpt: --
Problems with Session and transaction handling?
Read this: 
http://hibernate.org/42.html
-----------------------------------------------------------------------------
Hi,
     I have a problem inserting data in three tables having relationship using Hibernate.
Tables in Database
--------------------
1. PostProcessingConfiguration
   Fields - Id, Version
2. ProcessedParameterType
   Fields - Id, Version, Function, ParameterTypeId, PostProcessingCfgId
   ForeignKey - PostProcessingCfgId (PostProcessingConfiguration.Id)
                    - ParameterTypeId (ParameterType.Id)
3. ParameterType
   Fields - Id, Version, Name 
I have written PostProcessingConfiguration.java having Setters and getters 
-------------------------------------------------------------------------------
public class PostProcessingConfiguration extends CpmObject
{
    private List<ProcessedParameterType> processedParameterTypesList = new ArrayList<ProcessedParameterType>();
    // setters and getters method for Id and version written in CpmObject
    @OneToMany
    @JoinColumn(name = "PostProcessingCfgId", unique = false, nullable = false, insertable = false, updatable = false)
    public List<ProcessedParameterType> getProcessedParameterTypes()  {
        return processedParameterTypesList;
    }
    public void setProcessedParameterTypes(
            List<ProcessedParameterType> processedParameterTypesList) {
        this.processedParameterTypesList = processedParameterTypesList;
    }
}
I have written PostProcessingConfiguration.java having Setters and getters methods
-------------------------------------------------------------------------------
public class ProcessedParameterType extends CpmObject 
{
    // setters and getters method written for Id, Version and Function fields
    @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
    @ForeignKey(name = "FK_PPARAMTYPE_PARAMTYPE")
    @Index(name = "IDX_PPARAMTYPE_PARAMTYPE")
    @JoinColumn(name = "ParameterTypeId", insertable = false, updatable = false)
    public ParameterType getParameterType() {
        return parameterType;
    }
    public void setParameterType(ParameterType parameterType) {
        this.parameterType = parameterType;
    }
}
I have written one repository class for insertion
-------------------------------------------------------------------------------
public class ToolConfigurationRepository extends HibernateDaoSupport 
{
         
    // insert data into PostProcessingConfiguration Table 
    public List<PostProcessingConfiguration> createPostProcessingConfiguration(
            List<PostProcessingConfiguration> postProcessingConf) {
        HibernateTemplate template = getHibernateTemplate();
        Iterator<PostProcessingConfiguration> iterator = postProcessingConf
                .iterator();
        while (iterator.hasNext()) {
            PostProcessingConfiguration conf = iterator.next();
            // create into database
            template.save(conf);
        }
        return postProcessingConf;
    }
    // insert data into ProcessedParamType Table 
    public List<ProcessedParameterType> createProcessedParamTypes(
            List<ProcessedParameterType> processedParamTypes) {
        HibernateTemplate template = getHibernateTemplate();
        Iterator<ProcessedParameterType> iterator = processedParamTypes
                .iterator();
        while (iterator.hasNext()) {
            ProcessedParameterType processedParam = iterator.next();
            // create into database
            template.save(processedParam);
        }
        return processedParamTypes;
    }
}
-------------------------------------------------------------------------------
   I am expecting to insert data in both the tables.
   Record getting inserted in PostProcessingConfiguration table but not in 
ProcessedParameter table. And the above exception is thrown.
    I am not sure in the above code whether I have defined the annotations wrong or I am missing something else.
     Please help me if anybody have worked on inserting data in joined tables using hibernate.
Thanks and Regards
Radhika