eclipselink

How do I mark fields as required/optional when reading XML with MOXy?

萝らか妹 提交于 2019-12-24 16:29:28
问题 Having a trivial code like this: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) class A { @XmlPath("B/text()") private String b; @XmlPath("C/text()") private Integer c; ... } It works absolutely fine as long as I have apt values in my XML. I'd like to mark the field c as required, so MOXy throw every time I try to read the document where c is either not set, or invalid. What's the easiest solution? Update: Setting default values will also do. 回答1: EclipseLink JAXB (MOXy) or any JAXB

Maven and the “ is not a known entity type” error

女生的网名这么多〃 提交于 2019-12-24 15:35:51
问题 I generated a maven project with the quickstart archetype. So I obtained the following project structure: |-- src | |-- main | | |-- java | | |-- resources | |-- test | | |-- java | | |-- resources |-- pom.xml I modified the "pom.xml" file : <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com

Enhance generated DDL of EclipseLink

痞子三分冷 提交于 2019-12-24 13:33:48
问题 Is it possible to change the generated DDL statements of EclipseLink during the creation process? In the persistence.xml I use the table-creation-suffix, but it adds only some things to the CREATE TABLE statements. There are also a lot of ALTER TABLE statements, which I can not change. Something like a table-alteration-suffix would be nice. <property name="eclipselink.ddl-generation.table-creation-suffix" value=";" /> <property name="eclipselink.ddl-generation" value="drop-and-create-tables"

JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

为君一笑 提交于 2019-12-24 13:22:27
问题 I try to make a simple app using a rest service, eclipseLink and mysql. I want to make this run on a TomEE server (apache-tomee-plume-1.7.4). I deploy the app with eclipse. The deployment seems to be ok When I go to http://localhost:8080/eleve/ I'm getting : javax.servlet.ServletException: Error processing webservice request org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:98) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) java.io.IOException:

Jsf validation error (shown by h:message) while updating Model, why?

五迷三道 提交于 2019-12-24 12:18:47
问题 List.xhtml: <h:selectOneMenu value="#{produtosController.selected.codigo}"> <f:selectItems value="#{produtosController.itemsAvailableSelectOne}"/> </h:selectOneMenu> <h:commandButton action="#{produtosController.createByCodigos}" value="Buscar" /> Controller Class method: public String createByCodigos(){ items = new ListDataModel(ejbFacade.findByCodigos(current.getCodigo())); updateCurrentItem(); return "List"; } Facade Class method: public List<Produtos> findByCodigos(Integer codigo){ Query

Why EclipseLink maps a NVARCHAR type to an Object?

余生长醉 提交于 2019-12-24 11:44:19
问题 I am using the latest version of EclipseLink (2.2.0) with SQL Server 2005. Generating the classes, the type NVARCHAR is mapped to type Object in the classes. I suppose it should map to type String. Why is this happening? 回答1: How are you generating the classes? Are you using Eclipse Dali? I would just change the generate code to String. Perhaps report a bug with the IDE you are using. EclipseLink itself, does not generate classes. 来源: https://stackoverflow.com/questions/5883670/why

JPA + EclipseLink - Lazy Loading with closed EntityManager

守給你的承諾、 提交于 2019-12-24 11:37:32
问题 I'm using EclipseLink as JPA provider in a Java SE project. I have properly configured the weaving to allow the Lazy Loading. Unlike Hibernate (which throws LazyInitializationException), EclipseLink can get a proxy of LAZY relationship, even with a closed EntityManager. To run this query, it gets a new connection from the pool. Is there some setting that disables or changes the behavior of this feature? I need to get a null value or an exception when trying to access an unloaded attribute,

Discrepancy in marshal behaviour

纵饮孤独 提交于 2019-12-24 10:59:00
问题 I am testing MOXy 2.5.0 RC1. I marshalled the following to a string: <c r="C3" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <v>20</v> </c> It is represented by https://github.com/plutext/docx4j/blob/master/src/xlsx4j/java/org/xlsx4j/sml/Cell.java Notice the absence of any @XmlRootElement annotation With the reference implementation, the result, as expected, is: javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.internal.SAXException2: unable to

JPA generating duplicate keys

做~自己de王妃 提交于 2019-12-24 10:58:26
问题 I have two entities defined as: @Entity public class FileMaster implements java.io.Serializable{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long fileId; @NotNull @Column(unique = true) private String fileNumber = ""; private String subject = ""; @Temporal(TemporalType.DATE) private Date date=null; private String authPerson=""; private String authDesign=""; private String department=""; @OneToMany(mappedBy = "fileMaster", cascade = CascadeType.ALL, orphanRemoval = true)

JAX-WS & JAX-RS with EclipseLink MOXy and external mapping documents

。_饼干妹妹 提交于 2019-12-24 10:37:36
问题 This is about using JAX-WS with EclipseLink MOXy and my problem of not being able to use MOXy's external mapping documents in this combination. (The same actually seems to apply to JAX-RS as well, but I'm limiting the details to JAX-WS to keep this from becoming even longer than it already is). I first describe (in some detail) the context of my requirements and the test code I've written to try and solve them. The actual question follows at the end of the post. The context: In some legacy