eclipselink

How do I configure dynamic weaving using EclipseLink & Spring?

断了今生、忘了曾经 提交于 2019-12-05 16:50:40
问题 How do I configure dynamic weaving using EclipseLink & Spring? Right now I'm trying to get this working with a Junit test, but I'll later have to have it work with Tomcat (my department has been standardized on it for something like 10 years). I'm running into two main problems: 1. Spring wants a load time weaver: Exception: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:181) at org

JPA: How to get Id after persist in standalone java app

旧巷老猫 提交于 2019-12-05 16:10:13
This is a standalone java application, not web application. So when I persist the object like this public <T> T create(T t) { em.getTransaction().begin(); em.persist(t); em.flush(); em.getTransaction().commit(); return t; } The id inside the T t object is still null, even though a new row with correct data and id is created correctly inside the database. Usually in my web app that utilize @EJB , the id available right after I persist, since it persist the entity object into my persistence context, I am not sure if I have my persistence context here? This is how I mapped my id inside my @Entity

Exception: Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation

笑着哭i 提交于 2019-12-05 15:09:15
I'm getting exception when trying to execute test Please help . Thank you in advance I'm using : Java 7 , EclipseLink 2.5.0-SNAPSHOT, Spring 3.2.4 Test configuration file : <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" p:location="classpath:jdbc.properties" /> <bean id="tttDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}" p:username="${jdbc.username}" p:password="${jdbc.password}" /> <bean id="loadTimeWeaver" class="org.springframework

EclipseLink, lazy fetch collection is accessible outside of transaction

有些话、适合烂在心里 提交于 2019-12-05 14:54:27
I have an entity named User which has the following field called roles : @ManyToMany @JoinTable( name = "user_role", joinColumns = {@JoinColumn(name = "user_id", nullable = false)}, inverseJoinColumns = {@JoinColumn(name = "role_id", nullable = false)} ) private List<Role> roles; I load the User via the use of a service method and the service method is wrapped in a transaction (JTA). After calling the service method and retrieving the User , I access this role field outside of the transaction that was used to load the User entity. I was expecting to get an error because the eclipselink

MOXy's @XmlCDATA seems to have no affect

佐手、 提交于 2019-12-05 14:07:56
I would like to have the following returned to the browser (view source) <content> <![CDATA[Please show this inside a unescaped CDATA tag]]> </content> But I acutally get <content> Please show this inside a unescaped CDATA tag </content> If, I change the value of content to be &lt ;![CDATA[Please show this inside a unescaped CDATA tag]]&gt ; , the less than and the greater than for the tag are escaped. Wondering how to achieve what I wanted???? Here is my code import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core

EclipseLink - non Entity as target entity in the relationship attribute

 ̄綄美尐妖づ 提交于 2019-12-05 14:01:33
I am using the Netbeans IDE 8.0.2 and eclipselink 2.5.2. This occurring exception below when opening a connection, the problem is that this does not happen every time. The entity described in exception "Departmento" exactly follows the pattern of the other classes being that our system already contain approximately 500 entity classes and only in the new classes are taking place this exception. This entity was generated by that option "Entity Classes from Database" of Netbeans and added to the persistense XML ... Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018]

Should the id field of a JPA entity be considered in equals and hashCode?

泪湿孤枕 提交于 2019-12-05 11:46:06
问题 I hit a problem when writing tests for a database application using JPA2 and EclipseLink: I add some entity to a database, retrieve it later and want to compare it to an instance which has the values I expect to confirm that the addition worked as I intended. First I wrote something like assertEquals(expResult, dbResult); which failed, because I can't really know the value of id field, which is generated by the database and therefore dbResult differs from expResult which I created with new

Extending an entity

点点圈 提交于 2019-12-05 11:19:16
I have class named AbstractEntity, which is annotated with @MappedSuperclass. Then I have a class named User (@Entity) which extends AbstractEntity. Both of these exist in a package named foo.bar.framework. When I use these two classes, everything works just fine. But now I've imported a jar containing these files to another project. I'd like to reuse the User class and expand it with a few additional fields. I thought that @Entity public class User extends foo.bar.framework.User would do the trick, but I found out that this implementation of the User only inherits the fields from

Disabling EclipseLink cache

爱⌒轻易说出口 提交于 2019-12-05 11:13:20
In my application, when user logs in to the system the system reads some setting from DB and stores them on user's session. The system is performing this action by a JPA query using EclipseLink (JPA 2.0). When I change some settings in DB, and sign in again, the query returns the previous results. It seems that EclipseLink is caching the results. I have used this to correct this behavior but it does not work : query.setHint(QueryHints.cache_usage,cacheUsage.no_cache); If you want to set query hints, the docs recommend doing: query.setHint("javax.persistence.cache.storeMode", "REFRESH"); You

Exception in thread “main” javax.xml.bind.PropertyException: name: eclipselink.media-type value: application/json

こ雲淡風輕ζ 提交于 2019-12-05 10:23:32
问题 I'm attempting to follow the example located here but get an javax.xml.bind.PropertyException. I receive this exception because of the following line of code: marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json"); I have literally copy/pasted the example listed above so my code is exactly what you see there. Searching SO and Google for this has not been helpful, and thought I'd bring this to the geniuses at SO for some help. Any help would be most appreciated, (de