eclipselink

EclipseLink batch insert very very slow

妖精的绣舞 提交于 2019-12-05 00:21:02
问题 I'm trying to optimize my JPA implementation, using EclipseLink. I've added batch operations to it. But it is still taking A LOT of time to do 50 000 inserts. It takes more than 10 times the amount of time it takes to do the exact same insert using raw SQL with JDBC. To make sure batch operations were in fact working I used Wireshark to check my packets and it is not using batch inserts. Here's one of the insert packets: It is not doing: INSERT INTO ENTITYCLASSTEST (LASTNAME, NAME) VALUES (

JAXB outputting invalid XML when data contains non-displayable chars

百般思念 提交于 2019-12-04 23:32:03
问题 I'm using JAXB 2.2.5 to output Xml from a JAXB Model, the data is populated from the database and occasionally the database contains non-displayable characters that it should not such as 0x1a If it does then JAXB outputs invalid Xml by just outputting this char as is, shouldn't it escape it or something ? Update I wonder if there are any implementations that do fix this problem, maybe Eclipselink MOXy does ? EDIT I tried the workaround that fixes the illegal char issue however it changes the

When I use A JPA Query's getResultList(), are the results detached or managed?

核能气质少年 提交于 2019-12-04 23:25:38
When I have a JPA Query that I call .getResultList(), It gives me back a List of objects. Are the objects in that list managed or detached? That is, do I have to worry about merging or persisting them later if I make changes to them, or will those changes be picked up automatically? Ken Chan Yes, the objects returned from .getResultList() are managed. When you made changes on the managed objects, you do not worry about merging as those changes will be picked up by the EntityManager automatically. The managed objects will become detached when the EntityManager that is used to load that object

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

耗尽温柔 提交于 2019-12-04 21:59:15
问题 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

What is the right approach for Multi-tenancy using eclipselink

纵然是瞬间 提交于 2019-12-04 19:25:40
Hello I'm developing a web application using Vaadin framework, JPA EclipseLink as ORM, MYSQL as database. Currently I'm working to implement Multitenant structure for my app. Here I've to choose TABLE_PER_TENANT with different schema in a shared database strategy as I already have some tenants. Here is an example of my tenant specific entity: @Entity @Multitenant(MultitenantType.TABLE_PER_TENANT) @TenantTableDiscriminator(type = TenantTableDiscriminatorType.SCHEMA, contextProperty = PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT) public class UserAccount implements Serializable { .....

No [EntityType] was found for the key class […] in the Metamodel

家住魔仙堡 提交于 2019-12-04 17:20:31
问题 Entity: @Entity @Table(name="user_account") public class UserAccount implements Serializable{ private static final long serialVersionUID = -2606506548742732094L; @Id @GeneratedValue(strategy=GenerationType.TABLE) private Integer id; persistence.xml <persistence-unit name="Maze" transaction-type="RESOURCE_LOCAL"> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/> <property name="javax

EclipseLink doesn't create tables

时间秒杀一切 提交于 2019-12-04 16:54:26
I'm developing an application with eclipseLink and Spring. For now I'm using h2 like database. My trouble is that eclipseLink is not able to create tables. This is my configuration. Persistence.xml: <persistence> <persistence-unit name="myUnit"> //some classes definition <properties> <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" /> <property name="javax.persistence.jdbc.url" value="jdbc:h2:file:C:\Users\user\Desktop\myFolder\test.db" /> <property name="javax.persistence.jdbc.user" value="sa" /> <property name="javax.persistence.jdbc.password" value="" /> <property name=

Entity must be managed to call remove

元气小坏坏 提交于 2019-12-04 16:42:55
问题 What's going on here? @Stateless @LocalBean public class AppointmentCommentDao { public void delete(long appointmentCommentId) { AppointmentComment ac = em.find(AppointmentComment.class, appointmentCommentId); if (ac != null) { em.merge(ac); em.remove(ac); } } @PersistenceContext private EntityManager em; } On the call to remove I get an IllegalArgumentException with the message being Entity must be managed to call remove: ...., try merging the detached and try the remove again. 回答1: In your

How to Tell JPA the prefered DataType

你。 提交于 2019-12-04 16:16:36
问题 If I use JPA (EclipseLink) to create tables a String type results in a varchar2(255). How could I tell JPA (via Annotation) to create a varchar2(20) attribute. If I have a List JPA creates a BLOB(4000) but I would like a varchar2 (my serialized object's string is short) How is this possible? Do I have to do it by hand? 回答1: You need to use the columnDefinition property of the @Column annotation. i.e. @Column(columnDefinition="varchar2(20)") 回答2: If I use JPA (EclipseLink) to create tables a

How to call function using EclipseLink

空扰寡人 提交于 2019-12-04 15:39:11
How to call an Oracle function which returns sys_refcursor using EclipseLink? There is a documentation which states about calling a function, but not sure how to call a function which returns sys_refcursor. http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_namedstoredfunctionquery.htm I have tried as follows @NamedStoredFunctionQuery(name = "findEmployees", functionName = "getEmps", parameters = { @StoredProcedureParameter(queryParameter = "user", name = "username", direction = Direction.IN, type = String.class) } , returnParameter = @StoredProcedureParameter(queryParameter =