toplink

Unknown entity class error message even though the entity is marked with @Entity annotation

丶灬走出姿态 提交于 2019-12-03 13:07:13
I am building REST web app using Netbean6.9.1 and JPA EclipseLink. The issue I'm facing is even though my entity class MasatoTable is marked with Entity annotation, I get error: (java.lang.IllegalArgumentException: Unknown entity bean class: class entity.MasatoTable, please verify that this class has been marked with the @Entity annotation.) The thing is when I restart the GlassFish3 server from NetbeanIDE, it works for a while and somehow at some point, the error start showing up. I used to use Toplink Essential and had no issue but I've changed to EclipseLink and re-defiend persistence.xml

When to use Hibernate/JPA/Toplink?

巧了我就是萌 提交于 2019-12-03 05:19:51
问题 Right now I'm making an extremely simple website- about 5 pages. Question is if it's overkill and worth the time to integrate some sort of database mapping solution or if it would be better to just use plain old JNDI. I'll have maybe a dozen things I need to read/write from the database. I guess I have a basic understanding of these technologies but it would still take a lot of referring to the documentation. Anyone else faced with the decision before? EDIT: Sorry, I should've specified JNDI

When to use Hibernate/JPA/Toplink?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 18:37:01
Right now I'm making an extremely simple website- about 5 pages. Question is if it's overkill and worth the time to integrate some sort of database mapping solution or if it would be better to just use plain old JNDI. I'll have maybe a dozen things I need to read/write from the database. I guess I have a basic understanding of these technologies but it would still take a lot of referring to the documentation. Anyone else faced with the decision before? EDIT: Sorry, I should've specified JNDI to lookup the DB connection and JDBC to perform the operations. Short answer: It depends on the

JPA exception: Object: … is not a known entity type

微笑、不失礼 提交于 2019-11-30 07:25:45
问题 I'm new to JPA and I'm having problems with the autogeneration of primary key values. I have the following entity: package jpatest.entities; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class MyEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; public

COALESCE in JPA namedQuery

杀马特。学长 韩版系。学妹 提交于 2019-11-29 10:02:57
I have the following namedQuery select new test.entity.Emp(COALESCE(k.projectId,'N') as projectId, k.projectName) from Emp o inner join o.projects k However I am getting error expecting RIGHT_ROUND_BRACKET, found '(' How to handle COALESCE in namedQuery? Are there any other ways to handle null values in JPA? gknicker Coalesce is supported by JPA 2.0 API . The new construct is proprietary to Hibernate, not necessarily supported in all JPA implementations. First try the query without also trying to construct an object: select COALESCE(k.projectId,'N') as projectId, k.projectName from Emp o inner

JPA exception: Object: … is not a known entity type

这一生的挚爱 提交于 2019-11-29 03:43:42
I'm new to JPA and I'm having problems with the autogeneration of primary key values. I have the following entity: package jpatest.entities; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class MyEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; public Long getId() { return id; } public void setId(Long id) { this.id = id; } private String someProperty;

Do I have to close() every EntityManager?

我是研究僧i 提交于 2019-11-28 15:38:16
I have just started migrating my homegrown persistence framework to JPA. Given that the persistence frameworks hide a lot of the plumbing, I'm interested in knowing if NOT closing EntityManagers will create a resource leak, or if the frameworks will collect and close them for me. I intend in all places to close them, but do I HAVE to? At the moment using TopLink, just because it works with NetBeans easily, but am happy to investigate other JPA providers. It depends how you obtained it. If you created it using EntityManagerFactory you will have to close it no matter what framework you use. If

Do I have to close() every EntityManager?

冷暖自知 提交于 2019-11-28 14:26:37
问题 I have just started migrating my homegrown persistence framework to JPA. Given that the persistence frameworks hide a lot of the plumbing, I'm interested in knowing if NOT closing EntityManagers will create a resource leak, or if the frameworks will collect and close them for me. I intend in all places to close them, but do I HAVE to? At the moment using TopLink, just because it works with NetBeans easily, but am happy to investigate other JPA providers. 回答1: It depends how you obtained it.

GWT with JPA

蹲街弑〆低调 提交于 2019-11-28 06:35:27
I'm trying to build database application using GWT 1.5.3. I use JPA annotations with my objects. It seems in hosted mode GWT's RPC works fine. But when I try to compile my app using GWT-compiler I get errors like: "The import javax.persistence cannot be resolved", "Entity cannot be resolved to a type". toplink-essentials.jar is already included in my project path. What settings else do I need to solve this problem? You can use Gilead ( http://sourceforge.net/projects/gilead/ ) library to seamlessly manage JPA entities with GWT. Regards You need to include the source code for the JPA

JPA with TopLink: No META-INF/persistence.xml was found in classpath

大兔子大兔子 提交于 2019-11-28 03:30:53
问题 public class LoginTest { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("IRCBotPU"); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); Login lg = new Login(); lg.setPassword("password"); lg.setUserName("Rocky"); em.persist(lg); em.flush(); Login st = em.find(Login.class, lg.getPassword()); System.out.println(st); em.getTransaction().commit(); em.close(); emf.close(); } } I'm getting an Exception when I try to