From: <leg...@at...> - 2003-08-12 13:53:09
|
Message: The following issue has been closed. Resolver: Gavin King Date: Tue, 12 Aug 2003 8:01 AM I've fixed this in the 2.1 branch. I don't think its worth doing the fix for 2.0 branch .... the workaround is very easy: add a cascade="none" to the array mapping (the XML parser will complain, but it will work). --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-250 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-250 Summary: Cascade onto primitive-array Type: Bug Status: Closed Priority: Minor Resolution: FIXED Project: Hibernate2 Fix Fors: 2.1 beta 2 Assignee: Reporter: Teradyne Inc. Created: Tue, 12 Aug 2003 3:32 AM Updated: Tue, 12 Aug 2003 8:01 AM Environment: Windows XP Pro Java 1.4.1_02 MySQL 4.0.13-nt Description: If class: public class Foo { private int[] exponents; public Foo() {} public int[] getExponents() { return exponents; } public void setExponents(int[] exps) { this.exponents = exps; } } Is mapped with the following ..hbm.xml: <hibernate-mapping default-cascade="save-update"> <class name="Foo" table="foos"> <id column="id" type="int"> <generator class="native" /> </id> <primitive-array name="exponents" > <key/> <index/> <element type="integer"/> </primitive-array> </class> </hibernate-mapping> It causes the following error: java.lang.ClassCastException at net.sf.hibernate.type.ArrayType.getElementsIterator(ArrayType.java:42) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:276) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:341) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:739) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:605) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1213) at net.sf.hibernate.engine.Cascades$3.cascade(Cascades.java:88) --------------------------------------------- This method should only be called if you enable cascade for that collection (which makes no sense for a primitive array). For more details please read: https://sourceforge.net/forum/message.php?msg_id=2145750 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |