It works, but does not compile (only half a joke!) [message #434579] |
Fri, 07 September 2007 17:17  |
Eclipse User |
|
|
|
Hi Chaps,
I was able to manage a simple test project to use toplink and postgresql.
It's getting data from database and seems to work fine.
To be honest, the project compiles, otherwise the binary code would never
work! The problem seems to be Dali is not able to access properly the
database and reports a weird error on the imports. The error is:
Schema "test" cannot be resolved for table "Holiday"
and occours around the end of the second line below and beginning of third
line.
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
I've deleted my orm.xml (I use annotations) and my persistence.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
<provider> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvi der
</provider>
<class>com.jaacoo.tguide.model.dao.Holiday</class>
<class>com.jaacoo.tguide.model.dao.House</class>
<class>com.jaacoo.tguide.model.dao.QuoteDay</class>
<class>com.jaacoo.tguide.model.dao.StockOption</class>
<class>com.jaacoo.tguide.model.dao.Symbol</class>
<class>com.jaacoo.tguide.model.dao.TickNasdaq</class>
<properties>
<property name="toplink.jdbc.driver"
value="org.postgresql.Driver"/>
<property name="toplink.jdbc.url"
value="jdbc:postgresql://localhost:5432/test"/>
<property name="toplink.jdbc.user" value="test"/>
<property name="toplink.jdbc.password" value="test"/>
<property name="toplink.logging.level" value="SEVERE"/>
</properties>
</persistence-unit>
</persistence>
I've already tried to put toplink-essentials-agent.jar in the CLASSPATH and
also in the command line when calling Eclipse. I've tried this:
export
CLASSPATH=/opt/JavaIDE/glassfish-persistence/toplink-essenti als-agent.jar:/opt/JavaIDE/glassfish-persistence/toplink-ess entials.jar
/opt/JavaIDE/eclipse3.3-amd64/eclipse -vm /opt/JavaIDE/jdk1.5.0_12-amd64/jre/bin/java
and also this:
/opt/JavaIDE/eclipse3.3-amd64/eclipse -vm /opt/JavaIDE/jdk1.5.0_12-amd64/jre/bin/java -cp /opt/JavaIDE/glassfish-persistence/toplink-essentials-agent. jar:/opt/JavaIDE/glassfish-persistence/toplink-essentials.ja r
and also this:
/opt/JavaIDE/eclipse3.3-amd64/eclipse -vm /opt/JavaIDE/jdk1.5.0_12-amd64/jre/bin/java -javaagent:/opt/JavaIDE/glassfish-persistence/toplink-essent ials-agent.jar
and also this:
export CLASSPATH=/opt/JavaIDE/glassfish-persistence/toplink-essenti als.jar
/opt/JavaIDE/eclipse3.3-amd64/eclipse -vm /opt/JavaIDE/jdk1.5.0_12-amd64/jre/bin/java -javaagent:/opt/JavaIDE/glassfish-persistence/toplink-essent ials-agent.jar
Any idea?
Thank you in advance
--
Richard Gomes
|
|
|
|
|
|
|
|
Re: It works, but does not compile (only half a joke!) [message #605524 is a reply to message #434579] |
Fri, 07 September 2007 17:28  |
Eclipse User |
|
|
|
Richard Gomes wrote:
> Hi Chaps,
>
> I was able to manage a simple test project to use toplink and postgresql.
> It's getting data from database and seems to work fine.
>
> To be honest, the project compiles, otherwise the binary code would never
> work! The problem seems to be Dali is not able to access properly the
> database and reports a weird error on the imports. The error is:
>
> Schema "test" cannot be resolved for table "Holiday"
>
> and occours around the end of the second line below and beginning of third
> line.
>
> import javax.persistence.Embeddable;
> import javax.persistence.EmbeddedId;
> import javax.persistence.Entity;
>
> I've deleted my orm.xml (I use annotations) and my persistence.xml is:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
> <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
> <provider> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvi der
> </provider>
> <class>com.jaacoo.tguide.model.dao.Holiday</class>
> <class>com.jaacoo.tguide.model.dao.House</class>
> <class>com.jaacoo.tguide.model.dao.QuoteDay</class>
> <class>com.jaacoo.tguide.model.dao.StockOption</class>
> <class>com.jaacoo.tguide.model.dao.Symbol</class>
> <class>com.jaacoo.tguide.model.dao.TickNasdaq</class>
> <properties>
> <property name="toplink.jdbc.driver"
> value="org.postgresql.Driver"/>
> <property name="toplink.jdbc.url"
> value="jdbc:postgresql://localhost:5432/test"/>
> <property name="toplink.jdbc.user" value="test"/>
> <property name="toplink.jdbc.password" value="test"/>
> <property name="toplink.logging.level" value="SEVERE"/>
> </properties>
> </persistence-unit>
> </persistence>
>
>
>
>
> I've already tried to put toplink-essentials-agent.jar in the CLASSPATH
> and also in the command line when calling Eclipse. I've tried this:
>
> export
>
CLASSPATH=/opt/JavaIDE/glassfish-persistence/toplink-essenti als-agent.jar:/opt/JavaIDE/glassfish-persistence/toplink-ess entials.jar
> /opt/JavaIDE/eclipse3.3-amd64/eclipse -vm
> /opt/JavaIDE/jdk1.5.0_12-amd64/jre/bin/java
>
> and also this:
>
> /opt/JavaIDE/eclipse3.3-amd64/eclipse -vm
> /opt/JavaIDE/jdk1.5.0_12-amd64/jre/bin/java -cp
> /opt/JavaIDE/glassfish-persistence/toplink-essentials-agent. jar:/opt/JavaIDE/glassfish-persistence/toplink-essentials.ja r
>
> and also this:
>
> /opt/JavaIDE/eclipse3.3-amd64/eclipse -vm
> /opt/JavaIDE/jdk1.5.0_12-amd64/jre/bin/java
> -javaagent:/opt/JavaIDE/glassfish-persistence/toplink-essent ials-agent.jar
>
> and also this:
>
> export CLASSPATH=/opt/JavaIDE/glassfish-persistence/toplink-essenti als.jar
> /opt/JavaIDE/eclipse3.3-amd64/eclipse -vm
> /opt/JavaIDE/jdk1.5.0_12-amd64/jre/bin/java
> -javaagent:/opt/JavaIDE/glassfish-persistence/toplink-essent ials-agent.jar
>
>
> Any idea?
>
> Thank you in advance
>
oh... I realized that I need to provide more information:
This is a quite simple J2SE application. This is the code:
package com.jaacoo.tguide.model.test;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import com.jaacoo.tguide.model.dao.Holiday;
public class Hello {
public static void main(String[] args) {
// Start EntityManagerFactory
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("trader");
// Second unit of work
EntityManager entityManager = emf.createEntityManager();
EntityTransaction transaction = entityManager.getTransaction();
transaction.begin();
List list = entityManager
.createQuery("select h from Holiday h")
.getResultList(); // order by h.house,h.yyyymmdd asc
System.out.println( list.size() + " holiday(s) found" );
for (Object h : list) {
Holiday holiday = (Holiday) h;
System.out.println(holiday.getPk().getYyyymmdd());
}
transaction.commit();
entityManager.close();
// Shutting down the application
emf.close();
}
}
Thanks again
--
Richard Gomes
|
|
|
|
|
Re: It works, but does not compile (only half a joke!) [message #606086 is a reply to message #434583] |
Mon, 10 September 2007 19:05  |
Eclipse User |
|
|
|
Neil Hauge wrote:
> Richard,
>
> I believe you have run into Dali bug 193879. This bug caused problems
> resolving DB metadata on PostgreSQL. This bug is fixed in the maintenance
> branch, so you could take an early look at the current WTP 2.0.1 RC's.
> The 2.0.1 release should be available on the 28th of September. The RC's
> are available now for testing.
>
> http://download.eclipse.org/webtools/downloads/
>
> Hope this helps,
> Neil
Hi Neil,
Yes, after I upgraded ...Enablement for PostgreSQL, the errors dissapeared.
Thanks a lot!
But JPA perspective is not working anymore.
How can I download (may a complete?) installation with Dali and this
upgrade? Is it available?
Kind Regards
--
Richard Gomes
|
|
|
|
Powered by
FUDForum. Page generated in 0.04740 seconds