Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » New to JPA
New to JPA [message #434520] Wed, 18 July 2007 16:19 Go to next message
Glen Self is currently offline Glen Self
Messages: 7
Registered: July 2009
Junior Member
When trying to set up I get errors:
"The import java.persistence cannot be resolved"
which of course gives Entity cannot be resolved to a type etc.....
I can't find any jar that has this
Any ideas where to look?
Re: New to JPA [message #434521 is a reply to message #434520] Wed, 18 July 2007 18:12 Go to previous messageGo to next message
Karen Butzke is currently offline Karen Butzke
Messages: 220
Registered: July 2009
Senior Member
You can download TopLink Essentials, which is the JPA reference
implementation:

http://www.oracle.com/technology/products/ias/toplink/jpa/do wnload.html

Or any other runtime implementation of JPA would include the annotation
definitions.

Karen
Re: New to JPA [message #434523 is a reply to message #434521] Fri, 20 July 2007 00:32 Go to previous messageGo to next message
epson wang is currently offline epson wang
Messages: 32
Registered: July 2009
Member
you can use hibernate too.
Re: New to JPA [message #434524 is a reply to message #434523] Fri, 20 July 2007 08:06 Go to previous messageGo to next message
Glen Self is currently offline Glen Self
Messages: 7
Registered: July 2009
Junior Member
Installed top-link
Installed glassfish
Still the same - cannot import java.persistence
Where is it?
Re: New to JPA [message #434525 is a reply to message #434524] Fri, 20 July 2007 10:32 Go to previous messageGo to next message
Karen Butzke is currently offline Karen Butzke
Messages: 220
Registered: July 2009
Senior Member
Now that you have glassfish persistence installed you will need to add the
toplink-essentials.jar to your eclipse project classpath.

When creating a new JPA project, we provide 2 options to help specify the
JPA implementation.

1. Use implementation provided by server runtime
2. Use implementation library - this includes links to set up a library
and a JPA preference for the default JPA implementation library. This
will just make it easier the next time you create a new JPA project.

Since you already have a project, you can set up a library that points to
the toplink-essentials.jar and add it to your project. Or you can just
add the jar directly ro your project if you don't want a library.

Karen
Re: New to JPA [message #434526 is a reply to message #434525] Fri, 20 July 2007 15:36 Go to previous messageGo to next message
Glen Self is currently offline Glen Self
Messages: 7
Registered: July 2009
Junior Member
I added toplink-essentials.jar to my project and got the same error
I opened the jar and found that it contained javax.persistance so I
changed the import and most of the errors went away.
Now I get "This mapped class is not contained in any persistence unit" on
the @Entity
that preceeds
public class Entities implements Serializable {....
Re: New to JPA [message #434527 is a reply to message #434526] Fri, 20 July 2007 16:30 Go to previous message
Karen Butzke is currently offline Karen Butzke
Messages: 220
Registered: July 2009
Senior Member
Have you taken a look at the Dali tutorials and docs on our website?
http://www.eclipse.org/webtools/dali/docs/tutorial_1.0/dali_ jsf_tutorial.htm
You need a persistence.xml file and you need to specify your entities in a
persistence unit.

thanks,
Karen
Re: New to JPA [message #602461 is a reply to message #434520] Wed, 18 July 2007 18:12 Go to previous message
Karen Butzke is currently offline Karen Butzke
Messages: 220
Registered: July 2009
Senior Member
You can download TopLink Essentials, which is the JPA reference
implementation:

http://www.oracle.com/technology/products/ias/toplink/jpa/do wnload.html

Or any other runtime implementation of JPA would include the annotation
definitions.

Karen
Re: New to JPA [message #602470 is a reply to message #434521] Fri, 20 July 2007 00:32 Go to previous message
epson wang is currently offline epson wang
Messages: 32
Registered: July 2009
Member
you can use hibernate too.
Re: New to JPA [message #605056 is a reply to message #434523] Fri, 20 July 2007 08:06 Go to previous message
Glen Self is currently offline Glen Self
Messages: 7
Registered: July 2009
Junior Member
Installed top-link
Installed glassfish
Still the same - cannot import java.persistence
Where is it?
Re: New to JPA [message #605060 is a reply to message #434524] Fri, 20 July 2007 10:32 Go to previous message
Karen Butzke is currently offline Karen Butzke
Messages: 220
Registered: July 2009
Senior Member
Now that you have glassfish persistence installed you will need to add the
toplink-essentials.jar to your eclipse project classpath.

When creating a new JPA project, we provide 2 options to help specify the
JPA implementation.

1. Use implementation provided by server runtime
2. Use implementation library - this includes links to set up a library
and a JPA preference for the default JPA implementation library. This
will just make it easier the next time you create a new JPA project.

Since you already have a project, you can set up a library that points to
the toplink-essentials.jar and add it to your project. Or you can just
add the jar directly ro your project if you don't want a library.

Karen
Re: New to JPA [message #605064 is a reply to message #434525] Fri, 20 July 2007 15:36 Go to previous message
Glen Self is currently offline Glen Self
Messages: 7
Registered: July 2009
Junior Member
I added toplink-essentials.jar to my project and got the same error
I opened the jar and found that it contained javax.persistance so I
changed the import and most of the errors went away.
Now I get "This mapped class is not contained in any persistence unit" on
the @Entity
that preceeds
public class Entities implements Serializable {....
Re: New to JPA [message #605068 is a reply to message #434526] Fri, 20 July 2007 16:30 Go to previous message
Karen Butzke is currently offline Karen Butzke
Messages: 220
Registered: July 2009
Senior Member
Have you taken a look at the Dali tutorials and docs on our website?
http://www.eclipse.org/webtools/dali/docs/tutorial_1.0/dali_ jsf_tutorial.htm
You need a persistence.xml file and you need to specify your entities in a
persistence unit.

thanks,
Karen
Previous Topic:New to JPA
Next Topic:Problem with Generate DDL
Goto Forum:
  


Current Time: Sat Aug 30 00:28:17 EDT 2014

Powered by FUDForum. Page generated in 0.01946 seconds