-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Bad many-to-one mapping with composite PK using middlegen!
PostPosted: Wed Aug 31, 2005 9:44 am 
Beginner
Beginner

Joined: Tue May 31, 2005 1:16 pm
Posts: 35
Location: Bogota, Colombia
I have generated my hbm files using middlegen from a legacy database (which has a lot of composite PK's), and then my POJO's using hbm2java.

I'm struggling trying to persist one of my objects......

The sql query is inserting null in field "csoc_codigolinea", which is a required field. I am sure I'm setting all the values in the object I want to save. I guess it is a mapping error, my mapping is was generated using middlegen....

It seems to be a problem with the "many-to-one" associations that reference a composite PK. For instance... since my mapping includes
Code:
<many-to-one
        name="convenio"
        class="co.com.unionsoluciones.sofia.cartera.model.bo.Convenio"
        not-null="true"
      insert="false"
      update="false"
    >
        <column name="nsoc_codigoempresa" />
        <column name="csoc_codigoconvenio" />
    </many-to-one>


then "nsoc_codigoempresa" and "csoc_codigoconvenio" are reported null in the insert statement.

Please help!


My full mapping is

Mapping documents:
Code:
<class
name="co.com.unionsoluciones.sofia.cartera.model.bo.SolicitudCredito"
table="solicitudcredito_soc"
>
<meta attribute="implements" inherit="false">net.sf.hibernate.Lifecycle</meta>
<meta attribute="implements" inherit="false">net.sf.hibernate.Validatable</meta>
<meta attribute="implement-equals" inherit="false">true</meta>

<composite-id name="comp_id" class="co.com.unionsoluciones.sofia.cartera.model.bo.SolicitudCreditoPK">
<key-property
name="codigoEmpresa"
column="nsoc_codigoempresa"
type="java.lang.Integer"
length="2"
/>
<key-property
name="codigoOficina"
column="nsoc_codigooficina"
type="java.lang.Integer"
length="2"
/>
<key-property
name="numeroSolicitud"
column="nsoc_numerosolicitud"
type="java.lang.Integer"
length="9"
/>
</composite-id>

<property
name="fechaSolicitud"
type="java.sql.Timestamp"
column="dsoc_fechasolicitud"
not-null="true"
length="23"
/>
<property
name="fechaRadicacion"
type="java.sql.Timestamp"
column="dsoc_fecharadicacion"
not-null="true"
length="23"
/>
<property
name="valor"
type="java.math.BigDecimal"
column="msoc_valor"
not-null="true"
length="19"
/>
<property
name="numeroPlazo"
type="int"
column="nsoc_numeroplazo"
not-null="true"
length="3"
/>
<property
name="tipoGarantia"
type="java.lang.String"
column="csoc_tipogarantia"
not-null="true"
length="1"
/>
<property
name="observacion"
type="java.lang.String"
column="csoc_observacion"
length="2147483647"
/>
<property
name="estado"
type="java.lang.String"
column="csoc_estado"
not-null="true"
length="1"
/>

<!-- Associations -->
<!-- derived association(s) for compound key -->
<!-- bi-directional many-to-one association to Oficina -->
<many-to-one
name="oficina"
class="co.com.unionsoluciones.sofia.cartera.model.bo.Oficina"
update="false"
insert="false"
>
<column name="nsoc_codigoempresa" />
<column name="nsoc_codigooficina" />
</many-to-one>

<!-- bi-directional many-to-one association to Empresa -->
<many-to-one
name="empresa"
class="co.com.unionsoluciones.sofia.cartera.model.bo.Empresa"
update="false"
insert="false"
>
<column name="nsoc_codigoempresa" />
</many-to-one>

<!-- end of derived association(s) -->

<!-- bi-directional many-to-one association to Moneda -->
<many-to-one
name="moneda"
class="co.com.unionsoluciones.sofia.cartera.model.bo.Moneda"
not-null="true"
>
<column name="csoc_codigomoneda" />
</many-to-one>
<property
name="codigoPrograma"
column="csoc_codigoprograma"
type="java.lang.String"
length="5"
not-null="true"
/>
<!-- bi-directional many-to-one association to Convenio -->
<many-to-one
name="convenio"
class="co.com.unionsoluciones.sofia.cartera.model.bo.Convenio"
not-null="true"
insert="false"
update="false"
>
<column name="nsoc_codigoempresa" />
<column name="csoc_codigoconvenio" />
</many-to-one>
<!-- bi-directional many-to-one association to LineaCredito -->
<many-to-one
name="lineaCredito"
class="co.com.unionsoluciones.sofia.cartera.model.bo.LineaCredito"
not-null="true"
insert="false"
update="false"
>
<column name="nsoc_codigoempresa" />
<column name="csoc_codigolinea" />
</many-to-one>
<!-- bi-directional many-to-one association to DestinoCredito -->
<many-to-one
name="destinoCredito"
class="co.com.unionsoluciones.sofia.cartera.model.bo.DestinoCredito"
not-null="true"
>
<column name="csoc_codigodestino" />
</many-to-one>
<!-- bi-directional many-to-one association to SectorEmpresa -->
<many-to-one
name="sectorEmpresa"
class="co.com.unionsoluciones.sofia.cartera.model.bo.SectorEmpresa"
not-null="true"
>
<column name="csoc_codigosector" />
</many-to-one>
<!-- bi-directional many-to-one association to AsesorCredito -->
<many-to-one
name="asesorCredito"
class="co.com.unionsoluciones.sofia.cartera.model.bo.AsesorCredito"
not-null="true"
insert="false"
update="false"
>
<column name="nsoc_codigoempresa" />
<column name="csoc_tipodocumentoasesor" />
<column name="msoc_identificacionasesor" />
</many-to-one>
<!-- bi-directional many-to-one association to PlazoSolicitud -->
<many-to-one
name="plazoSolicitud"
class="co.com.unionsoluciones.sofia.cartera.model.bo.PlazoSolicitud"
not-null="true"
>
<column name="csoc_codigoplazo" />
</many-to-one>
<!-- bi-directional one-to-many association to PersonaSolicitud -->
<set
name="personaSolicituds"
lazy="true"
inverse="true"
cascade="save-update"

>
<key>
<column name="npes_codigoempresa" />
<column name="npes_codigooficina" />
<column name="npes_numerosolicitud" />
</key>
<one-to-many
class="co.com.unionsoluciones.sofia.cartera.model.bo.PersonaSolicitud"
/>
</set>
<!-- bi-directional one-to-many association to GarantiaSolicitud -->
<set
name="garantiaSolicituds"
lazy="true"
inverse="true"
cascade="save-update"
>
<key>
<column name="ngas_codigoempresa" />
<column name="ngas_codigooficina" />
<column name="ngas_numerosolicitud" />
</key>
<one-to-many
class="co.com.unionsoluciones.sofia.cartera.model.bo.GarantiaSolicitud"
/>
</set>
<!-- bi-directional one-to-many association to DocumentoAnexo -->
<set
name="documentoAnexos"
lazy="true"
inverse="true"
cascade="save-update"
>
<key>
<column name="ndoa_codigoempresa" />
<column name="ndoa_codigooficina" />
<column name="ndoa_numerosolicitud" />
</key>
<one-to-many
class="co.com.unionsoluciones.sofia.cartera.model.bo.DocumentoAnexo"
/>
</set>

</class>
</hibernate-mapping>

Hibernate version:
Hibernate 2.1.8

Code between sessionFactory.openSession() and session.close():

this.getHibernateTemplate().save(objeto);
[Using HibernateDaoSupport from Spring]

Full stack trace of any exception that occurs:
INFO: Entrando a registrar solicitud
Hibernate: insert into solicitudcredito_soc (dsoc_fechasolicitud, dsoc_fecharadicacion, msoc_valor, nsoc_numeroplazo, csoc_tipogarantia, csoc_observacion, csoc_estado, csoc_codigomoneda, csoc_codigoprograma, csoc_codigodestino, csoc_codigosector, csoc_codigoplazo, nsoc_codigoempresa, nsoc_codigooficina, nsoc_numerosolicitud) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
30-Aug-2005 20:07:51 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 515, SQLState: HY000
30-Aug-2005 20:07:51 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'csoc_codigolinea', table 'cartera.dbo.solicitudcredito_soc'; column does not allow nulls. INSERT fails.
30-Aug-2005 20:07:51 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 3621, SQLState: HY000
30-Aug-2005 20:07:51 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The statement has been terminated.
30-Aug-2005 20:07:51 net.sf.hibernate.impl.SessionImpl execute
SEVERE: Could not synchronize database state with session
org.springframework.jdbc.UncategorizedSQLException: (Hibernate operation): encountered SQLException [[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'csoc_codigolinea', table 'cartera.dbo.solicitudcredito_soc'; column does not allow nulls. INSERT fails.]; nested exception is java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'csoc_codigolinea', table 'cartera.dbo.solicitudcredito_soc'; column does not allow nulls. INSERT fails.
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'csoc_codigolinea', table 'cartera.dbo.solicitudcredito_soc'; column does not allow nulls. INSERT fails.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:101)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:462)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:436)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2392)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
at org.springframework.orm.hibernate.HibernateTemplate$22.doInHibernate(HibernateTemplate.java:595)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate.HibernateTemplate.flush(HibernateTemplate.java:593)
at co.com.unionsoluciones.sofia.cartera.model.dao.hibernate.SolicitudCreditoDaoHibernateImpl.guardarSolicitudCredito(SolicitudCreditoDaoHibernateImpl.java:37)
at co.com.unionsoluciones.sofia.cartera.model.service.impl.ServicioCreditoImpl.registrarSolicitud(ServicioCreditoImpl.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:284)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.orm.hibernate.HibernateInterceptor.invoke(HibernateInterceptor.java:163)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy1.registrarSolicitud(Unknown Source)
at co.com.unionsoluciones.sofia.cartera.model.TestServicioCredito.testRegistrarSolicitud(TestServicioCredito.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
30-Aug-2005 20:07:51 co.com.unionsoluciones.sofia.cartera.model.service.impl.ServicioCreditoImpl registrarSolicitud
SEVERE: SolicitudCredito co.com.unionsoluciones.sofia.cartera.model.bo.SolicitudCredito@6c08b2[comp_id=co.com.unionsoluciones.sofia.cartera.model.bo.SolicitudCreditoPK@c74fe[codigoEmpresa=1,codigoOficina=1,numeroSolicitud=1]] ya existe
org.springframework.jdbc.UncategorizedSQLException: (Hibernate operation): encountered SQLException [[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'csoc_codigolinea', table 'cartera.dbo.solicitudcredito_soc'; column does not allow nulls. INSERT fails.]; nested exception is java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'csoc_codigolinea', table 'cartera.dbo.solicitudcredito_soc'; column does not allow nulls. INSERT fails.
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'csoc_codigolinea', table 'cartera.dbo.solicitudcredito_soc'; column does not allow nulls. INSERT fails.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:101)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:462)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:436)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2392)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
at org.springframework.orm.hibernate.HibernateTemplate$22.doInHibernate(HibernateTemplate.java:595)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate.HibernateTemplate.flush(HibernateTemplate.java:593)
at co.com.unionsoluciones.sofia.cartera.model.dao.hibernate.SolicitudCreditoDaoHibernateImpl.guardarSolicitudCredito(SolicitudCreditoDaoHibernateImpl.java:37)
at co.com.unionsoluciones.sofia.cartera.model.service.impl.ServicioCreditoImpl.registrarSolicitud(ServicioCreditoImpl.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:284)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.orm.hibernate.HibernateInterceptor.invoke(HibernateInterceptor.java:163)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy1.registrarSolicitud(Unknown Source)
at co.com.unionsoluciones.sofia.cartera.model.TestServicioCredito.testRegistrarSolicitud(TestServicioCredito.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Name and version of the database you are using:
MS SQL SERVER 2000

The generated SQL (show_sql=true):
[SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert the value NULL into column 'msoc_identificacionasesor', table 'cartera.dbo.solicitudcredito_soc'; column does not allow nulls. INSERT fails.

_________________
Julian Garcia


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 9:48 am 
Beginner
Beginner

Joined: Tue May 31, 2005 1:16 pm
Posts: 35
Location: Bogota, Colombia
The plugin options I have used are:

<hibernate
destination="${build.gen-src.dir}"
package="co.com.unionsoluciones.sofia.cartera.model.bo"
genXDocletTags="true"
genIntergratedCompositeKeys="false"
javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
standardCascade="save-update"
lifecycle="true"
validatable="true"
equalsHashcode="true"
extends="co.com.unionsoluciones.sofia.cartera.model.bo.base.BaseBO"
/>

_________________
Julian Garcia


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 1:05 pm 
Beginner
Beginner

Joined: Tue May 31, 2005 1:16 pm
Posts: 35
Location: Bogota, Colombia
My insert wasn't including the required fields due to these lines in my mapping file:
Code:
insert="false"
update="false"


is this the default behaviour of middlegen? how can I get middlegen not to generate insert and update as false?

now, inside my many-to-one I have set

Code:
insert="true"


this will allow the insert statement to include the fields that were being reported null.

Now, I am getting this exception:

net.sf.hibernate.MappingException: Repeated column in mapping for class co.com.unionsoluciones.sofia.cartera.model.bo.SolicitudCredito should be mapped with insert="false" update="false".

The problem might be that as you can see on the full mapping, the field "nsoc_codigoempresa" is part of almost all my PK's.....


Is there any way to get rid of this error? How can I configure middlegen to handle my legacy database, full of composite id's?

_________________
Julian Garcia


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 7:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I've only a had a quick look. The mapping appears OK to me. The update of those fields are managed by the primary key rather than the relationship. If you change it to insert=true the error is correct as its reporting the problem that the field is mapped twice, eg, once in the key and once in the many-to-one.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 10:12 pm 
Beginner
Beginner

Joined: Tue May 31, 2005 1:16 pm
Posts: 35
Location: Bogota, Colombia
The problem is that if I set insert="false" the field is ignored in the insert statement, and since it is a required field in the database, it fails.

Any ideas?

Thanks for your help.

_________________
Julian Garcia


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.