I have this ListMenu that contains a set of ListMenuItems. Each ListMenuItem knows it's parent menu and can link to a new ListMenu (submenu) or a couple of other things. The problem is that I for some reason get a "MappingException: No persister for java.lang.String" when I try to insert a new ListMenuItem (after I save LiteMenu but before a flush). I don't get an exception if I remove mapping for subMenu but then the listmenu_id in the database don't get set.
Any ideas?
/Marcus
Hibernate version:
2.1
Mapping documents:
<class name="se.dreampark.iptv.domain.vod.ListMenu"
table="listmenu"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version">
<id name="id" column="uid" type="long" unsaved-value="0">
<generator class="native"/>
</id>
<property name="name" type="string" column="name"/>
<property name="title" type="string" column="title"/>
<property name="externalId" type="string" column="externalid"/>
<property name="fileName" type="string" column="filename"/>
<many-to-one
name="ondemandProvider"
class="se.dreampark.iptv.domain.admin.OndemandProvider"
cascade="save-update"
column="ondemandprovider_id"/>
<set name="menuItems" inverse="true" lazy="true" order-by="sort" cascade="delete-orphan">
<key column="parentmenu_id"/>
<one-to-many class="se.dreampark.iptv.domain.vod.ListMenuItem"/>
</set>
</class>
<class name="se.dreampark.iptv.domain.vod.ListMenuItem" table="listmenuitem"
dynamic-update="false" dynamic-insert="false" select-before-update="false"
optimistic-lock="version">
<id name="id" column="uid" type="long" unsaved-value="0">
<generator class="native"/>
</id>
<property name="sort" type="int" column="sort"/>
<many-to-one name="parentMenu" class="se.dreampark.iptv.domain.vod.ListMenu"
cascade="save-update" column="parentmenu_id"/>
<many-to-one name="movieCategory" class="se.dreampark.iptv.domain.vod.MovieCategory"
cascade="save-update" column="moviecategory_id"/>
<many-to-one name="movieList" class="se.dreampark.iptv.domain.vod.MovieList"
cascade="save-update" column="movielist_id"/>
<!-- No exception if this one is removed -->
<many-to-one name="subMenu" class="se.dreampark.iptv.domain.vod.ListMenu"
cascade="none" column="listmenu_id"/>
</class>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
[se.dreampark.contentprovider.sf.SFMovieDataFetcher] ERROR - Exception while fetching menu data.
org.springframework.orm.hibernate.HibernateSystemException: No persister for: java.lang.String; nested exception is net.sf.hibernate.MappingException: No persister for: java.lang.String
net.sf.hibernate.MappingException: No persister for: java.lang.String
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344)
at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2686)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2693)
at net.sf.hibernate.impl.SessionImpl.isUnsaved(SessionImpl.java:1090)
at net.sf.hibernate.impl.SessionImpl.nullifyTransientReferences(SessionImpl.java:1036)
at net.sf.hibernate.impl.SessionImpl.nullifyTransientReferences(SessionImpl.java:1022)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:927)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:775)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387)
at org.springframework.orm.hibernate.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:583)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:357)
at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:580)
at se.dreampark.iptv.dao.hibernate.vod.ListMenuHibernateDao.insertListMenuItem(ListMenuHibernateDao.java:38)
at se.dreampark.contentprovider.sf.SFMenuPopulator.populateListMenu(SFMenuPopulator.java:71)
at se.dreampark.contentprovider.sf.SFMenuPopulator.populateListMenu(SFMenuPopulator.java:61)
at se.dreampark.contentprovider.sf.SFMenuPopulator.populate(SFMenuPopulator.java:47)
at se.dreampark.contentprovider.sf.SFMovieDataFetcher.populateMenu(SFMovieDataFetcher.java:254)
at se.dreampark.contentprovider.sf.SFMovieDataFetcher.fetchAllData(SFMovieDataFetcher.java:176)
at se.dreampark.contentprovider.sf.SFMovieDataFetcherTest.testFetchData(SFMovieDataFetcherTest.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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)
- Exception while fetching menu data.
org.springframework.orm.hibernate.HibernateSystemException: No persister for: java.lang.String; nested exception is net.sf.hibernate.MappingException: No persister for: java.lang.String
net.sf.hibernate.MappingException: No persister for: java.lang.String
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344)
at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2686)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2693)
at net.sf.hibernate.impl.SessionImpl.isUnsaved(SessionImpl.java:1090)
at net.sf.hibernate.impl.SessionImpl.nullifyTransientReferences(SessionImpl.java:1036)
at net.sf.hibernate.impl.SessionImpl.nullifyTransientReferences(SessionImpl.java:1022)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:927)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:775)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1387)
at org.springframework.orm.hibernate.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:583)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:357)
at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:580)
at se.dreampark.iptv.dao.hibernate.vod.ListMenuHibernateDao.insertListMenuItem(ListMenuHibernateDao.java:38)
at se.dreampark.contentprovider.sf.SFMenuPopulator.populateListMenu(SFMenuPopulator.java:71)
at se.dreampark.contentprovider.sf.SFMenuPopulator.populateListMenu(SFMenuPopulator.java:61)
at se.dreampark.contentprovider.sf.SFMenuPopulator.populate(SFMenuPopulator.java:47)
at se.dreampark.contentprovider.sf.SFMovieDataFetcher.populateMenu(SFMovieDataFetcher.java:254)
at se.dreampark.contentprovider.sf.SFMovieDataFetcher.fetchAllData(SFMovieDataFetcher.java:176)
at se.dreampark.contentprovider.sf.SFMovieDataFetcherTest.testFetchData(SFMovieDataFetcherTest.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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)
Now deleting fixtures.
[net.sf.hibernate.transaction.JDBCTransaction] DEBUG - rollback
[net.sf.hibernate.impl.SessionImpl] DEBUG - transaction completion
[net.sf.hibernate.transaction.JDBCTransaction] DEBUG - re-enabling autocommit
[net.sf.hibernate.impl.SessionImpl] DEBUG - closing session
[net.sf.hibernate.impl.SessionImpl] DEBUG - disconnecting session
[net.sf.hibernate.impl.SessionImpl] DEBUG - transaction completion
[se.dreampark.contentprovider.sf.SFMovieDataFetcherTest] INFO - Rolled back transaction after test execution
- Rolled back transaction after test execution
Name and version of the database you are using:
MySQL 4.1
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
[se.dreampark.contentprovider.sf.SFMenuPopulator] DEBUG - XML Item [1] : Film.size() : 11
[se.dreampark.contentprovider.sf.SFMenuPopulator] DEBUG - Creating list with name : Film
[se.dreampark.iptv.dao.hibernate.vod.ListMenuHibernateDao] DEBUG - !!! Inserting ListMenu : Film
[net.sf.hibernate.engine.Cascades] DEBUG - id unsaved-value: 0
[net.sf.hibernate.impl.SessionImpl] DEBUG - saveOrUpdate() unsaved instance
[net.sf.hibernate.impl.SessionImpl] DEBUG - saving [se.dreampark.iptv.domain.vod.ListMenu#<null>]
[net.sf.hibernate.impl.SessionImpl] DEBUG - executing insertions
[net.sf.hibernate.engine.Cascades] DEBUG - processing cascades for: se.dreampark.iptv.domain.vod.ListMenu
[net.sf.hibernate.engine.Cascades] DEBUG - cascading to saveOrUpdate()
[net.sf.hibernate.impl.SessionImpl] DEBUG - saveOrUpdate() persistent instance
[net.sf.hibernate.engine.Cascades] DEBUG - done processing cascades for: se.dreampark.iptv.domain.vod.ListMenu
[net.sf.hibernate.impl.WrapVisitor] DEBUG - Wrapped collection in role: se.dreampark.iptv.domain.vod.ListMenu.menuItems
[net.sf.hibernate.persister.EntityPersister] DEBUG - Inserting entity: se.dreampark.iptv.domain.vod.ListMenu (native id)
[net.sf.hibernate.impl.BatcherImpl] DEBUG - about to open: 0 open PreparedStatements, 0 open ResultSets
[net.sf.hibernate.SQL] DEBUG - insert into listmenu (name, title, externalid, filename, ondemandprovider_id) values (?, ?, ?, ?, ?)
Hibernate: insert into listmenu (name, title, externalid, filename, ondemandprovider_id) values (?, ?, ?, ?, ?)
[net.sf.hibernate.impl.BatcherImpl] DEBUG - preparing statement
[net.sf.hibernate.persister.EntityPersister] DEBUG - Dehydrating entity: [se.dreampark.iptv.domain.vod.ListMenu#<null>]
[net.sf.hibernate.type.StringType] DEBUG - binding 'sf.231' to parameter: 1
[net.sf.hibernate.type.StringType] DEBUG - binding 'Film' to parameter: 2
[net.sf.hibernate.type.StringType] DEBUG - binding '231' to parameter: 3
[net.sf.hibernate.type.StringType] DEBUG - binding 'sf.231' to parameter: 4
[net.sf.hibernate.type.LongType] DEBUG - binding '1' to parameter: 5
[net.sf.hibernate.persister.AbstractEntityPersister] DEBUG - Natively generated identity: 23
[net.sf.hibernate.impl.BatcherImpl] DEBUG - done closing: 0 open PreparedStatements, 0 open ResultSets
[net.sf.hibernate.impl.BatcherImpl] DEBUG - closing statement
[net.sf.hibernate.engine.Cascades] DEBUG - processing cascades for: se.dreampark.iptv.domain.vod.ListMenu
[net.sf.hibernate.engine.Cascades] DEBUG - done processing cascades for: se.dreampark.iptv.domain.vod.ListMenu
[se.dreampark.contentprovider.sf.SFMenuPopulator] DEBUG - XML Item [2] : Premiär.size() : 0
[se.dreampark.contentprovider.sf.SFMenuPopulator] DEBUG - POPULATING Item : Premiär
[se.dreampark.iptv.dao.hibernate.vod.ListMenuHibernateDao] DEBUG - !:!:!: Inserting ListMenuItem : Premiär Parent is : Film
[net.sf.hibernate.engine.Cascades] DEBUG - id unsaved-value: 0
[net.sf.hibernate.impl.SessionImpl] DEBUG - saveOrUpdate() unsaved instance
[net.sf.hibernate.impl.SessionImpl] DEBUG - saving [se.dreampark.iptv.domain.vod.ListMenuItem#<null>]
[net.sf.hibernate.impl.SessionImpl] DEBUG - executing insertions
[net.sf.hibernate.engine.Cascades] DEBUG - processing cascades for: se.dreampark.iptv.domain.vod.ListMenuItem
[net.sf.hibernate.engine.Cascades] DEBUG - cascading to saveOrUpdate()
[net.sf.hibernate.impl.SessionImpl] DEBUG - saveOrUpdate() persistent instance
[net.sf.hibernate.engine.Cascades] DEBUG - done processing cascades for: se.dreampark.iptv.domain.vod.ListMenuItem
... exception (see above) ...
|