This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Modern JavaScript for the Impatient and have Cay Horstmann on-line!
See this thread for details.
Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!

Sergio Silva

Greenhorn
+ Follow
since May 03, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sergio Silva

I'm trying to write a generic method that receives as argument a class and his primary key, and constructs a Select with fetch all properties.

I'm testing this with a simple example.

I have an entity AdmLanguage that have a OneToMany (with FetchType. LAZY) relationship with a entity AdmResources.

I'm writing the query:

SELECT t FROM AdmLanguage t FETCH ALL PROPERTIES WHERE t.languageid = 1


I'm getting the result query:

select admlanguag0_.languageId as languageId12_, admlanguag0_.description as descript2_12_, admlanguag0_.languageCode as language3_12_
from ADM_Language admlanguag0_
where admlanguag0_.languageId=1


Shouldn't this "Fetch All properties" take all the resources associated to the language either?
The code from the original post is updated!

It's all code there now!

Can you guys help me?
Yes, i have the code as you tell me to, but have the same problem...

I don't have the rest of the code now, just later, can you guys remember what could be wrong until i post all code?

thks
I have a Database that i need to persist and that i can't change his structure.

With reverse engineering i created the persistence model, but now i have a problem.

I have the following class:




And the class:
APK



The OperationInterval class:



When i validate the model, it gives the error:

org.hibernate.AnnotationException: Column name operationintervalid of com.....entity.A not found in JoinColumns.referencedColumnName

So... I commented the joincolumn anotation... and the result is:

org.hibernate.HibernateException: Missing column: operationintervalsByOperationintervalid_operationIntervalId in TheAtable



How can i solve this problem ? I can't change th
I have a Database that i need to persist and that i can't change his structure.

With reverse engineering i created the persistence model, but now i'm with problems:

Class EventActions:





The Pk Class:




The OperationInterval class:



When i validate the model, it gives the error:

org.hibernate.AnnotationException: Column name operationintervalid of Eventactions not found in JoinColumns.referencedColumnName

Caused by: org.hibernate.AnnotationException: Column name operationintervalid of com.criticalsoftware.chums.data.entity.hums.HumsBumeventact
ions not found in JoinColumns.referencedColumnName
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:319)
at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:64)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:474)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:295)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:88
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:416)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
at org.ow2.easybeans.persistence.JPersistenceContext.init(JPersistenceContext.java:72)
at org.ow2.easybeans.persistence.JPersistenceContext.<init>(JPersistenceContext.java:65)
at org.ow2.easybeans.persistence.PersistenceUnitManager.addExtraPersistenceUnitInfos(PersistenceUnitManager.java:8
at org.ow2.easybeans.persistence.PersistenceUnitManager.<init>(PersistenceUnitManager.java:64)
at org.ow2.easybeans.persistence.xml.PersistenceXmlFileAnalyzer.analyzePersistenceXmlFile(PersistenceXmlFileAnalyzer.java:143)
at org.ow2.easybeans.container.JContainer3.start(JContainer3.java:271)
at org.ow2.easybeans.osgi.ejbjar.Activator.startContainer(Activator.java:129)
at org.ow2.easybeans.osgi.ejbjar.Activator.start(Activator.java:91)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
... 14 more
Nested Exception:


So... I commented the joincolumn anotation... and the result is:

org.hibernate.HibernateException: Missing column: operationintervalsByOperationintervalid_operationIntervalId in yogurt.dbx.EventActions



How can i solve this problem ? I can't change the database.
[ October 13, 2007: Message edited by: Sergio Silva ]