eclipselink

ClassCastException in JPA Entitiy after redeploy (Glassfish 3.1.2)

老子叫甜甜 提交于 2019-12-04 08:24:42
I have a strange effect when undeploying and deploying a WebArchive (.war) with Glassfish 3.1.2. $ asadmin undeploy myWebApp; asadmin deploy target/myWebApp.war It deploys normally, but when I fetch an entity bean via the entity manager, it throws an Exception: [#|2012-12-11T15:26:09.772+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=119;_ThreadName=Thread-2;|java.lang.ClassCastException: org.YourEntity cannot be cast to org.YourEntity The exception is thrown in the q.getSingleResult() call. @PersistenceContext(unitName = "org.my-PU") private

How to set namespace aware to false?

只愿长相守 提交于 2019-12-04 06:56:31
I'm trying to parse some XML with EclipseLink MOXy, and it's failing on the line with the xsi attribute. If I remove this, it parses fine. However, I've got 100GiB of XML to wade through and changing the source files is not an option. It's been suggested that if I can set XmlParser.setNamespaceAware(false) then it should work - but I've got no idea how to configure this, without breaking right into the guts of MOXy. <record> <header> <!-- citation-id: 14404534; type: journal_article; --> <identifier>info:doi/10.1007/s10973-004-0435-2</identifier> <datestamp>2009-04-28</datestamp> <setSpec>J<

ScrollableCursor from EclipseLink throws SQLException: The result set is closed. on remote env

巧了我就是萌 提交于 2019-12-04 06:24:22
问题 I have problem with ScrollableCursor. On my local environment it works well but on remote env I got exception: Internal Exception: java.sql.SQLException: The result set is closed. Error Code: 0 at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1620) at org.eclipse.persistence.queries.ScrollableCursor.getPosition(ScrollableCursor

How to replace EclipseLink 2.3.2 with EclipseLink 2.5 in WebLogic Server 12c

梦想与她 提交于 2019-12-04 06:03:42
I currrently try to run Docx4j in WebLogic Server 12c. WebLogic Server 12c comes with EclipseLink 2.3.2. There is a similar Post describing the situation which unfortunately yield no answer. Docx4j does not work with the JAXB (MOXy) implementation which is part of EclipseLink 2.3.2. I got Docx4j running standalone with EclipseLink 2.5. So I am very confident that using EclipseLink 2.5 with Weblogic Server 12c will solve the issue with Docx4j. How can I replace the EclipseLink Vesion 2.3.2 the WebLogic Server 12c is running on with EclipseLink Version 2.5? You can created a shared library in

how to disable cache in eclipselink

泄露秘密 提交于 2019-12-04 05:00:39
问题 I have tried disabling L2 cache in EclipseLink with Eclipse indigo by using following properties in persistence.xml:- <property name="eclipselink.cache.shared.default" value="false"/> <shared-cache-mode>NONE</shared-cache-mode> Basically I am testing one scenario whether same object created in two different sessions is hitting database twice or both sessions are referring to same object created in earlier session in memory cache. It should not because L2 cache is disabled by mentioning above

Retrieving JPA Entity List and metadata

旧时模样 提交于 2019-12-04 04:56:47
I wanted to know if there is a way to get all the Entities classes and their metadata for a specific persistent unit in JPA. By metadata I mean not only the fields, but also their column name, lenght, precision, datatype, and also the table name and anything that I can get. I tried with the metamodel but I think that's more for the JPQL queries only. I need to be able to show the user all the active Entities for some PU, and I don't want to hardcode them in some array or in a database, I want the API to tell me what Entities does it have. And also, if it is possible, get the managed instances

Eclipselink JPA gets error when inserting into Derby table with generated primary key

我只是一个虾纸丫 提交于 2019-12-04 04:27:42
问题 EclipseLink seems to be incorrectly passing a null primary key value to Derby when persisting into a table with generated primary key. Derby returns error of Attempt to modify an identity column in this case. Derby needs a SQL statement that excludes the id value. My question is how do I coerce EclipseLink to send the right SQL? Details follow... I am using Eclipselink to map to a Derby database (v10.8.1.2) under the latest Netbeans 7.3beta2. The database table primary key is auto generated:

JPA simple many-to-many with eclipselink

风格不统一 提交于 2019-12-04 03:58:31
问题 I've this ER diagram: That was translated into these classes: User.java @Entity @Table(name = "user") @NamedQueries({ @NamedQuery(name = "User.findAll", query = "SELECT u FROM User u")}) public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Integer id; @Column(name = "name") private String name; @OneToMany(cascade = CascadeType.ALL, mappedBy =

How to setup a JTA data source in EclipseLink/JPA 2.0 in an Java EE 6 application for derby embedded database?

孤者浪人 提交于 2019-12-04 03:28:37
问题 I am not able to find ecbDB JTA data source in the unit test. For RESOURCE_LOCAL the same persistence.xml works. Only within an EJB container it fails to locate a JTA data source. I get the following exception when the unit test is executed.. SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'ecbDB' in SerialContext [Root exception is javax.naming.NameNotFoundException:

How to insert date/time in the UTC zone into MySQL via EclipseLink using Joda-Time?

耗尽温柔 提交于 2019-12-04 03:17:58
问题 I need to store date/time in UTC zone into MySQL database (of a DATETIME type column). When a user enters a date, it is first converted to org.joda.time.DateTime by a JSF converter. Before inserting this date into MySQL database, it again needs to be converted to java.util.Date - thanks to EclipseLink. The following is the converter that again converters org.joda.time.DateTime to java.util.Date though it is not really needed to see this converter. package joda.converter; import java.util.Date