eclipselink

eclipselink moxy xpath - selecting all child elements of the current node or all elements in a document with a particular name

情到浓时终转凉″ 提交于 2019-12-08 08:32:39
问题 i have this xpath defined for moxy in a jaxb class @XmlPath("child::*/REG") public List entries; but it won't unmarshal the xml document correctly. the List variable called entries is empty. i've also tried @XmlPath("*/REG") public List entries; i've also tried @XmlPath("//REG") public List entries; without joy but if i do @XmlPath("BANKGIRO/REG") public List entries; it's fine and the list is populated. I haven't looked through the source yet but I'm guessing this type of xpath is not

Eclipselink Pooling equivalent to C3PO

空扰寡人 提交于 2019-12-08 08:25:00
问题 I am trying to prevent this logging The last packet successfully received from the server was 10,255 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. I already set the the connection url with auto reconnect in the persistence.xml What I want is that there will be a connection pool, check the connection every minute or hour so the connection is still alive. The Hibernate has this feature with c3po. like the ff. <property name="hibernate.c3p0.timeout"

Querying a collection of embeddable elements using eclipselink

大憨熊 提交于 2019-12-08 07:53:02
问题 I have the following JPA (2.0.2) entities: Employee @Entity @Table(name = "T_EMPLOYEE") public class Employee { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @ElementCollection @CollectionTable(name = "T_COMPETENCE") private Set<Competence> competences; // Getter and setters } and Competence @Embeddable public class Competence { @JoinColumn(nullable = false) @ManyToOne private Skill skill; // Getter and setters } (The skill entity shouldn't be important and is

EclipseLink MOXy: Override rules of binding files

痴心易碎 提交于 2019-12-08 07:51:12
问题 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>

Create Null Object Unmarshalling Empty Element with JAXB

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 07:48:28
I am using JAXB (EclipseLink implementation) in a JAX-RS webservice. When an empty element is passed in the XML request an empty object is created. Is it possible to set JAXB to create a null object instead? Example XML: <RootEntity> <AttributeOne>someText</AttributeOne> <EntityOne id="objectID" /> <EntityTwo /> </RootEntity> When unmarshalling, an instance of EntityOne is created and the id attribute set to "objectID" and an instance of EntityTwo is created with null attributes. Instead I would like a null object for EntityTwo as having an empty object is causing me problems with JPA

Problem in JPA-Mapping

泪湿孤枕 提交于 2019-12-08 07:35:27
问题 I have a situation where my DB tables are like below, I am wondering how to have JPA mappings for this kind of tables , espacially for the auction_param_values which do not have primary key ID Table Name : auction with primary key as auction_id Table Name : *auction_param* with primary key as auction_param_id Table AUCTIO_PARAM is used stores the details of parameters such as Start_Date , End_Date etc. auction_param_id | auction_param_desc 1 | start date 2 | end_date Table Name : auction

Check whether a JTA transaction is successfully committed

[亡魂溺海] 提交于 2019-12-08 06:46:27
问题 Is there a way to check if the current transaction is committed or not in JPA entity listeners something like the following? @ApplicationScoped public class EntityListener { @Inject private Event<EntityEvent> event; @Inject private EntityManager entityManager; @Resource private UserTransaction userTransaction; @PostPersist @PostUpdate @PostRemove public void onChange(Entity entity) { // This is only a piece of pseudo code. if (userTransaction.isComitted()) { // Do something. } } } Entity

Invalid Oracle URL specified with Sniffy

陌路散爱 提交于 2019-12-08 05:53:53
问题 I'm trying to configure Sniffy to work with Oracle. I'm using Glassfish as application server, with JPA 2.0, and EclipseLink as provider. When EclipseLink tries to allocate the connection, it fails saying that the Oracle URL specified is invalid, because of the "sniffer:" prefix, I guess: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is javax.persistence.PersistenceException:

JPA ManyToMany where annotation

梦想与她 提交于 2019-12-08 05:43:38
问题 I'm using JPA / EclipseLink 2.5.2 and want to add an additional where clause to my ManyToMany Mapping. The SQL Code would look like this: SELECT * FROM Friends f INNER JOIN User u ON f.friend_id = u.id WHERE f.verified=1; So I managed to do the JoinMapping with: @Entity @NamedQueries({ @NamedQuery(name="User.findAll", query="SELECT u FROM User u"), @NamedQuery(name="User.login", query="SELECT a FROM User a WHERE a.username = :name and a.password = :password"), @NamedQuery(name="User.findId",

Retrieve information from JPA Metamodel

天大地大妈咪最大 提交于 2019-12-08 05:28:40
问题 Jpa 2 metamodel has one known use: type safe criteria query. My question is different: I suppose metamodel can be source of information like length, human friendly description, left-right alligment etc, for example for building pretty GUI table (desktop or web, no matter). I imagine such quasi code: SomeTable st = buildTable(Person_.class, Person_.surName, Person_.Height) Tell me, I'm thinking in wrong way? My google research give no result. Or give some info to start reading EDIT: auto