Temp temp = new Temp();
temp.getTempType.setTypeId(1);
tempServiceImpl.add(temp);
之后
List<Temp> temps = objImpl.getTempList();
temps中新插入的对象的属性tempType类对象中没有被填充
比如temps.get(1);
是本来存在的
String typename =temps.get(1).getTempType().getTypeName();
typename 是有值的
temps.get(2);
是刚添加的
String typename =temps.get(2).getTempType().getTypeName();
typename 是NULL的
但是他们的ID都是存在的 对了 我设置的事物
<!-- 声明式事物配置 开始-->
<tx:advice id="txAdvice" transaction-manager="myHibTransactionManager">
<tx:attributes>
<tx:method name="get*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="modify*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="invoke*" propagation="REQUIRED" />
<tx:method name="upload*" propagation="REQUIRED" />
<tx:method name="*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="bizMethods"
expression="execution(* com.oa.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethods" />
</aop:config>
<!-- 声明式事物配置 结束-->
Temp类中关联的TempType我在 hbm.xml中设成了lazy="false"
不过没啥效果
大家有知道的能告诉我下吗 多谢了
temp.getTempType.setTypeId(1);
tempServiceImpl.add(temp);
之后
List<Temp> temps = objImpl.getTempList();
temps中新插入的对象的属性tempType类对象中没有被填充
比如temps.get(1);
是本来存在的
String typename =temps.get(1).getTempType().getTypeName();
typename 是有值的
temps.get(2);
是刚添加的
String typename =temps.get(2).getTempType().getTypeName();
typename 是NULL的
但是他们的ID都是存在的 对了 我设置的事物
<!-- 声明式事物配置 开始-->
<tx:advice id="txAdvice" transaction-manager="myHibTransactionManager">
<tx:attributes>
<tx:method name="get*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="modify*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="invoke*" propagation="REQUIRED" />
<tx:method name="upload*" propagation="REQUIRED" />
<tx:method name="*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="bizMethods"
expression="execution(* com.oa.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethods" />
</aop:config>
<!-- 声明式事物配置 结束-->
Temp类中关联的TempType我在 hbm.xml中设成了lazy="false"
不过没啥效果
大家有知道的能告诉我下吗 多谢了
重新发送请求 查询到的就是有值的唯独 修改后 查询 或者 增加后查询 查询不到
只有修改 或者查询前的值