org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling

Hi
I am facing a problem with the Hibernate framework.
I have a parent table and associate child table
When I try to insert a record to the Parent it is not inserting the record to the child.It is getting inserted to the parent.
I am not getting any exception also
I am using sesson.save(parent object).

do I need to explicitly do session.save(child object)?
mapping xml for the parent

<hibernate-mapping package="com.ert.nwcs.symbology.dataaccess">
<class name="TbNewsCode" table="TB_NEWS_CODE" schema="NWCS">
<id name="newsCodeId" type="big_decimal">
<column name="NEWS_CODE_ID" precision="22" scale="0" />
<generator class="assigned" />
</id>
<property name="newsCode" type="string">
<column name="NEWS_CODE" length="10" not-null="true" />
</property>
<property name="newsType" type="big_decimal">
<column name="NEWS_TYPE" precision="22" scale="0" not-null="true" />
</property>
<set name="tbNewsCodeChild" inverse="true" >
<key>
<column name="NEWS_CODE_ID" precision="22" scale="0" not-null="true" />
</key>
<one-to-many class="TbNewsCodeChild" />
</set>
</class>
</hibernate-mapping>

mapping xml for child

<hibernate-mapping package="com.ert.nwcs.symbology.dataaccess">
<class name="TbNewsCodeParent" table="TB_NEWS_CODE_CHILD" schema="NWCS">
<composite-id name="id" class="TbNewsCodeChildId">
<key-many-to-one name="tbNewsCode" class="TbNewsCode">
<column name="NEWS_CODE_ID" precision="22" scale="0" />
</key-many-to-one>
<key-property name="childCode" type="string">
<column name="CHILD_CODE" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>

Please help me resolve this problem.
I tried using cascade="all" or cascade ="save-update" option in the parent mapping xml, but it is giving me some error when it tries to access the getter method of child

 

------------------------------------solution----------------------------------------------------------------------------

 

Hi All,
I was able to solve the problem
my parent object set contained the string attibutes which actually should have contained the child objects.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
org.mvel2.PropertyAccessException: [Error: null pointer: xsetz.indexOf('.')] [Near : {... xsetz.indexOf('.') > 0 ....}] ^ [Line: 1, Column: 1] at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:450) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:163) at org.mvel2.optimizers.dynamic.DynamicOptimizer.optimizeAccessor(DynamicOptimizer.java:80) at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159) at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115) at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:125) at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85) at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123) at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119) at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:113) at org.mvel2.MVEL.executeExpression(MVEL.java:929) at com.creating.services.mdruleexecute.MdruleMain.lambda$runMdResult$0(MdruleMain.java:85) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException: null at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:383) ... 14 common frames omitted
最新发布
06-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值