eclipselink

EclipseLink, lazy fetch collection is accessible outside of transaction

霸气de小男生 提交于 2019-12-07 07:38:45
问题 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

Disabling EclipseLink cache

余生长醉 提交于 2019-12-07 06:50:45
问题 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); 回答1: If you want to set

Eclipse Fonts Zoom out & Zoom in Issue

人盡茶涼 提交于 2019-12-07 06:00:57
问题 How to Zoom in and Zoom out text in Eclipse? I found plugins but I can not Install Manually Kindly tell me the procedure to install different Plugins in Eclipse. I asked this question after facing lot of issue using Android development tools(Eclipse). 回答1: Check out this link and you will love it Eclipse-Fonts First you have to open eclipse, in help Menu, find "Install new Softwares" paste the below link in "Works with" text Box http://eclipse-fonts.googlecode.com/svn/trunk/FontsUpdate/ and

Is there a way to suppress FindBugs from generating warnings on code generated by static weaving?

时间秒杀一切 提交于 2019-12-07 05:41:36
问题 I'm getting what I think are false positives from FindBugs (2.0.2) and Sonar (3.7.3) on code that is being generated via static weaving of EclipseLink (2.5.1) JPA entities. Specifically, I am seeing multiple occurrences of ES_COMPARING_PARAMETER_STRING_WITH_EQ Comparison of String parameter using == or != in com.test.domain.MyEntity._persistence_set(String, Object) and URV_INHERITED_METHOD_WITH_RELATED_TYPES Inherited method com.test.domain.MyEntity._persistence_get(String) returns more

Extending an entity

随声附和 提交于 2019-12-07 05:11:06
问题 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

Spring managed transactions, EclipseLink JPA, custom isolation level

你。 提交于 2019-12-07 04:01:00
问题 I suspect this one is embarrassing an I am doing it wrong in a terrible way, but please bear with me. I have a Spring application with Spring-managed transactions. It uses EclipseLink JPA. I have a method which does a findByNativeQuery() followed by a merge() . I need this to happen in a real SERIAL transaction isolation level. I tried adding @Transactional(isolation=Isolation.SERIALIZABLE) This doesn't work because org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect#beginTransaction

Insert after delete same transaction in Spring Data JPA

℡╲_俬逩灬. 提交于 2019-12-07 02:46:56
问题 Using Spring Data JPA I have the next flow inside the same transaction (REQUIRES_NEW) : Remove a set of user's predictions with this Spring Data JPA repository method. @Query(value = "DELETE FROM TRespuestaUsuarioPrediccion resp WHERE resp.idEvento.id = :eventId AND resp.idUsuario.id = :userId") @Modifying void deleteUserPredictions(@Param("userId") int userId, @Param("eventId") int eventId); Insert the new user's predictions and save the master object (event). eventRepository.save(event);

Glassfish: Unable to map datasource JNDI name to portable name using glassfish-web.xml

北城余情 提交于 2019-12-07 02:11:57
问题 I'm going slightly insane trying to make a Java EE 6 webapp portable between Glassfish AS 3.x and JBoss AS 6 (and 7 when released). Because each server maps JNDI names for datasources differently, I need to specify an application-private internal name for the datasource in persistence.xml then use glassfish-web.xml or jboss-web.xml (as appropriate) to map that to a real datasource name in the server. The theory is simple (well, for EE): Use internal name in persistence.xml, eg "my-datasource"

How to set collection items for in-clause in jpql?

北慕城南 提交于 2019-12-07 02:02:25
问题 Is there a possiblity in JPA 2.0 to set a collection for in-clause in jpql-query? (I'm using EclipseLink) The next example fails: TypedQuery<Person> q = em.createQuery("select p from Person p where p.name in (?1)", Person.class); List<String> names = Arrays.asList(new String[] { "Bill Gates", "Steve Jobs" }); // THIS FAILS q.setParameter(1, names); List<Person> persons = q.getResultList(); for (Person p: persons) { System.out.println(p.getName()); } Is there another way to do it? 回答1: Here is

EclipseLink MOXy: Override rules of binding files

落爺英雄遲暮 提交于 2019-12-07 01:53:28
I would, in the scenario below, like the binding of java-type name="SubClass" to be applied to set the text field on SuperClass. However it is not. Is there a problem with overriding the bindingsA.xml? According to the Overriding rules documentation : If the same java-type occurs in multiple files, any values that are set in the later file, will override values from the previous file What do I need to do to make it work? Input: <?xml version="1.0" encoding="UTF-8"?> <a text="A text">B text</a> Bindings A: <?xml version="1.0"?> <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds