and when I try to get all data from table Category using the HQL:
Code:
from Category c, order by category_id,parent_id,name
Code:
Hibernate: select item0_.item_id as item_id0_, item0_.itemName as itemName0_, item0_.createDate as createDate0_ from item item0_ where item0_.item_id=?
Code:
org.springframework.orm.hibernate.HibernateObjectRetrievalFailureException: No row with the given identifier exists: 1, of class: com.artconstructionsystems.dblayer.vobjects.Item; nested exception is net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 1, of class: com.artconstructionsystems.dblayer.vobjects.Item
net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 1, of class: com.artconstructionsystems.dblayer.vobjects.Item
at net.sf.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:38)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1964)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:208)
at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:130)
at net.sf.hibernate.collection.AbstractCollectionPersister.readElement(AbstractCollectionPersister.java:365)
at net.sf.hibernate.collection.Set.readFrom(Set.java:233)
at net.sf.hibernate.loader.Loader.readCollectionElement(Loader.java:384)
at net.sf.hibernate.loader.Loader.getRowFromResultSet(Loader.java:240)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:285)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:1020)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:995)
at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:83)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:288)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3315)
at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:336)
at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3168)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:143)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1063)
at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1554)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
at org.springframework.orm.hibernate.HibernateTemplate$19.doInHibernate(HibernateTemplate.java:647)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:314)
at org.springframework.orm.hibernate.HibernateTemplate.find(HibernateTemplate.java:633)
at org.springframework.orm.hibernate.HibernateTemplate.find(HibernateTemplate.java:612)
at com.artconstructionsystems.dblayer.persistance.DBCategories.getCategories(DBCategories.java:57)
at com.artconstructionsystems.dblayer.AppTest.testRetrieveCategories(AppTest.java:121)
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:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
or how could I impelement the next query using HQL?
Code:
select * from category,item,category_item where category.category_id = category_item.category_id and category_item.item_id = item.item_id
Please help
Regards
Marco