eclipselink

How do I delete all JPA entities?

元气小坏坏 提交于 2019-12-13 19:48:45
问题 In my testing code I need to have a blank/empty database at each method. Is there code that would achieve that, to call in the @Before of the test? 回答1: Actually you always can use JPQL, em .createQuery("DELETE FROM MyEntity m") .executeUpdate() ; But note, there is no grants that entity cache would be cleaned also. But for unit-test purposes it is look like good solution. 回答2: In my testing code I need to have a blank/empty database at each method. I would run the test methods insider a

How to add persisted entities in a relationship marked with CascadeType.ALL?

做~自己de王妃 提交于 2019-12-13 19:26:09
问题 I have an Entity with a bidirectional ManyToMany relationship (on the same entity) marked as CascadeType.ALL . Here is how it looks for the Contact entity: @ManyToMany(cascade= CascadeType.ALL) private List<Contact> parentContacts = new ArrayList<Contact>(); @ManyToMany(cascade= CascadeType.ALL, mappedBy="parentContacts") private List<Contact> childContacts = new ArrayList<Contact>(); I have a method on the server side supposed to do save this entity: public AltContact saveContact

RunTime Retention policy java annotations doesn't work in Weblogic 12C

南笙酒味 提交于 2019-12-13 19:25:25
问题 We are planning to upgrade our product to Web-logic 12.C and WebSphere 8 stack ( Earlier it was WLC 10.3.5 and WAS 7). But issue in one of the web service component causing entire application failed to deploy in web logic. It works perfectly fine with WebSphere 8. When deploying the EAR, Application sever throws 'Exception [EclipseLink-59] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DescriptorException' . After more analysis, I found below code

Modify JPA schema at runtime with EclipseLink running on JBoss

蹲街弑〆低调 提交于 2019-12-13 19:13:44
问题 I am new to JPA and JBoss, so sorry in advance if this is a stupid question. I have application running on JBoss using EclipseLink that retrieves entities from various databases based on a JPQL string. This is working great, except one database contains multiple schema's. I would like to be able to specify which schema to use, at runtime, and select all entities that belong to that schema, without modifying the JPQL string. To further complicate things, I would also like to join across schema

how to set @SequenceGenerator schema in multitenancy

旧城冷巷雨未停 提交于 2019-12-13 16:17:20
问题 I'm facing this issue, my entity Profile is : @Entity @Table(name="profile") @Multitenant(value=MultitenantType.TABLE_PER_TENANT) @TenantTableDiscriminator(type=TenantTableDiscriminatorType.SCHEMA, contextProperty="eclipselink.tenant-id") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING, length = 17) public class Profile implements Serializable, Comparable<Profile> { private static final long

Setting default allocation size for all entities?

眉间皱痕 提交于 2019-12-13 16:14:02
问题 I want to set the default allocationSize that is set by default to 50 to another value. Is there a way to do that? I'd prefer to do this with default JPA, but Eclipselink would also be ok. I don't want to specify the allocationSize in each Entity I use. @TableGenerator(name = "name", pkColumnValue = "pkColumnValue", allocationSize=1000) 回答1: You can't do that with standard JPA. There isn't even an option of setting it in orm.xml "persistence-unit-defaults". With DataNucleus JPA you can

Configuring the Mule JPA module to use Eclipse Link and MySQL

ぃ、小莉子 提交于 2019-12-13 15:55:37
问题 I'm trying to write a Mule ESB application that reads an XML file into a domain object and then writes that object to a MySQL database using JPA. I have figured out most of the needed config but I am running into a problem where the Mule JPA module (https://github.com/mulesoft/mule-module-jpa) doesn't seem to be committing the sql queries. I have set the Mule JPA component to flush the queries and I can see them being written to the MySQL general log but a COMMIT is never done, so the data

@XmlDiscriminatorNode/@XmlDescriminatorValue not working on WebLogic Server

若如初见. 提交于 2019-12-13 13:29:50
问题 Following are the classes I am using for create sub classes using MOXy JAXB conversion on WebLogic 10.3.2 version. I am using the EclipseLink 2.4.1 MOXy for generating the XML. I am unable to generate the type attribute in the following code. Let me know if I am doing anything wrong here. I am using EclipseLink MOXy 2.4.1 and WebLogic 10.3.2 and MOXy 2.4.1 is configured in the WebLogic import javax.xml.bind.annotation.*; import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorNode;

Can't find the “org.eclipse.persistence” Maven dependency

匆匆过客 提交于 2019-12-13 13:27:31
问题 I installed Eclipse Helios with the m2eclipse maven plugin. I want to create an application using JPA. So, what I do is: New > Maven Project then I select the maven default archetype. The problem is that I want to add the "org.eclipse.persistence" dependency that I can't find. Where is it? Can we add it manually? Should I update a sort of "repository"? Then, is it the right archetype that I'm using? 回答1: EclipseLink is not available in Maven central repository, you need to add its repository

Can I get MOXy to convert a string to a boolean when generating json

梦想与她 提交于 2019-12-13 13:15:55
问题 The object model has an element ended of type String public class LifeSpan { protected String begin; protected String end; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String ended; .... but its actually only ever a boolean, (I dont know the significance of the XmlJavaTypeAdapter annotation) When output as XML gives <life-span><begin>1999-04</begin><ended>true</ended></life-span> so doesn't really matter if defined as boolean or string but JSON output is "life-span" : { "begin"