eclipselink

Date conversation error during jaxb marshall on a JPA object using eclipselink

梦想的初衷 提交于 2019-12-11 05:15:53
问题 I stuck on this Date conversation error for quite some time ... I am using eclipselinks, openJPA under TomcatEE environment, and trying to use jaxb doing marshalling. I met a problem for marshall one JPA object, which contains Date, TimeStamp elements. The exception message is --- javax.xml.bind.MarshalException - with linked exception: [Exception [EclipseLink-3002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ConversionException Exception

EclipseLink lazy loading hangs on reference class

岁酱吖の 提交于 2019-12-11 04:55:57
问题 I am attempting to query a person by id and in my schema below i have a @OneToMany reference between Address and Person and a ManyToOne reference between person and School. I use a named query and query hints to get the best performing query for this simple task but looking at the stack trace (Relevant parts posted), EclipseLink generates three Select statements when all i want is the person object by id? Using eager fetching was killing performance and so my question is how can i simply

Using JPA CriteriaBuilder to generate query where attribute is either in a list or is empty

房东的猫 提交于 2019-12-11 04:53:13
问题 I am trying to use the JPA CriteriaBuilder to generate a query for an entity called "TestContact" that has a many-to-many join with another entity called "SystemGroup" where the attribute for this join called "groups". The objective of the query is to retrieve records from the "TestContact" entity where the "groups" attribute is either in a list or is empty. The code I'm using is as follows public List<TestContact> findWithCriteriaQuery(List<SystemGroup> groups) { CriteriaBuilder cb = em

@XmlInverseReference - invalid token in json in a bidirectional JPA relationship

佐手、 提交于 2019-12-11 04:33:33
问题 I have cyclic issues with a 2 way JPA relationship using Jersey. I am trying to solve the cyclic dependency with @XmlElement and @XmlInverseReference, and while getting closer - my json wont parse as it seems to be introducing an invalid "close bracket". My entities look as below: @Entity(name = "PR_GPT") @Table @XmlRootElement @PersistenceUnit(unitName = "graps-jpa") public class PrGPT { @ManyToOne(optional=false) @JoinColumn(name="THERAPY_AREA") @XmlInverseReference(mappedBy="gpts")

InvocationTargetException: javax/persistence/Persistence

不问归期 提交于 2019-12-11 04:29:45
问题 Im trying to follow the example in chapter 2 of the book Beginning Java EE 6 Platform with GlassFish 3. I am using EclipseLink, Derby and Maven from cmd in Windows. I really can't figure this out and would be grateful for some help! This line EntityManagerFactory emf = Persistence.createEntityManagerFactory("chapter02PU"); in my Main.java class generates the following error: [INFO] Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] [INFO] ---------------------------------

eclipselink without persistence.xml

谁说胖子不能爱 提交于 2019-12-11 03:55:48
问题 I'm not a big fan of XML files. Therefore I'm wondering if there is a way to use eclipselink without its persistence.xml configuration file. Why? Because I want to manage different databases dynamically. It would be much easier to do it without the XML file. I'm surprised that I couldn't find anything on the web for now. 回答1: Not really, but you could create an EclipseLink ServerSession directly and wrap it with an EntityManagerFactoryImpl, but I would not suggest it. You would be better off

Why do subqueries with nested properties in EclipseLink always produce an unnecessary/redundant/duplicate/superfluous join?

旧时模样 提交于 2019-12-11 03:52:03
问题 I wanted to generate the following SQL through EclipseLink (2.6.1) JPA criteria. SELECT zonecharge0_.charge AS col_0_0_ FROM projectdb.zone_charge zonecharge0_ WHERE ( EXISTS ( SELECT country1_.country_id FROM projectdb.country country1_ WHERE country1_.country_id=? and zonecharge0_.zone_id=country1_.zone_id ) ) AND ( zonecharge0_.weight_id IN ( SELECT MAX(weight2_.weight_id) FROM projectdb.weight weight2_ WHERE weight2_.weight BETWEEN 0 AND 60 ) ) Running both of the following criteria and

Why does eclipselink 2.5.0 does not support Override TableGenerator or SequenceGenerator in subclasses while hiberate does support?

隐身守侯 提交于 2019-12-11 03:39:51
问题 As titled. Isn't it common to share Id definition in a base entity class? such as following: @MappedSuperclass public abstract class BaseEntity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.TABLE) private Long id; public Long getId() {return this.id;} public void setId(Long id) { this.id = id; } ... } While in subclass it is suppose to work as following: @Entity @Table(name = "sub_entity_table") @TableGenerator(name = "SUB_ENTITY_SEQUENCE", initialValue = 1,

Use of Multiple Inheritance in EclipseLink MOXy

陌路散爱 提交于 2019-12-11 03:34:27
问题 I'm trying to use spring ( @Autowire annotation into Jaxb Model class) ..... @XmlAttribute(name = "object-id") @XmlSchemaType(name = "positiveInteger") protected BigInteger objectId; @XmlTransient @Autowired MediationCacheManager cacheManager; Where MediationCacheManager is extended from three interfaces On creation of JaxbContext i catch an exception: Exception [EclipseLink-50089] (Eclipse Persistence Services - 2.5.0.v20121116-8650760): org.eclipse.persistence.exceptions.JAXBException

JPA CascadeType.REMOVE not working

天大地大妈咪最大 提交于 2019-12-11 03:18:09
问题 I have two entities Business which is composed of a list of Departments @Entity @Table(name = "Business") public class Business implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "Id") private Long id; @OneToMany(mappedBy = "business", cascade = {CascadeType.PERSIST, CascadeType.REMOVE}) private List<Department> departments; @OneToMany(mappedBy = "business", orphanRemoval = true, cascade =