java-ee-6

JSF 2.0 - selectOneMenu defaults to 0 when empty

风格不统一 提交于 2019-12-21 05:56:29
问题 For my project i want to implement a combobox with h:selectOneMenu . I read many posts about how to handle the selectOneMenu properly and how to implement a custom converter. The combobox shall store the ID ( Long ) from a different DB Table (named fk_ID) for which a constrain is in place. So far everything seems to function as planned. Now to my problem: The column fk_ID is optional, so the first option in the combobox is a f:selectItem with no value labeled "choose ...". When I save the

Are Java EE 6 CDI events transactional?

巧了我就是萌 提交于 2019-12-21 03:39:43
问题 Are Java EE 6 CDI events transactional? If I fire an event in a transaction, and subsequently roll back the transaction, are the effects of the Event listener rolled back as well? Is this behaviour dependent on the event listener itself supporting transactions? What about if I try and roll-back the exception from within then event listener, does it roll-back the transaction that fired the event? 回答1: From the events chapter of the CDI 1.0 specification, one can define an event to be

What is Weld, JSR-299?

醉酒当歌 提交于 2019-12-21 03:24:08
问题 I've found lots of tutorials showing Weld code samples, but not an introductory overview. Could you please suggest an introductory article, or answer the following: What does Weld do/give you? How does it relate to Java EE 6? How would one use it in a Java EE 6 project? If one uses it in a Java EE 6 project, what is it supplanting, if anything? 回答1: What does Weld do/give you? Weld is the reference implementation of the abstract JSR-299 API, which is better known as CDI, Contexts and

EJB 3.1 application deployed as WAR-only: What about ejb-jar.xml?

一世执手 提交于 2019-12-20 21:05:03
问题 I have a JavaEE6 application, consisting of Web stuff and EJBs and which is deployed as WAR-only (using EJB3.1). The build is based on Maven. I just read about a new possibility to order the module initialization in Java EE 6 here which i also need for my application. Also, i would like to have an option to define some EJB properties in XML. Since the example is deployed as an EAR-project the order is defined in the application.xml. But in a WAR-deployed project, there is no application.xml.

EJB 3.1 application deployed as WAR-only: What about ejb-jar.xml?

时光总嘲笑我的痴心妄想 提交于 2019-12-20 21:03:52
问题 I have a JavaEE6 application, consisting of Web stuff and EJBs and which is deployed as WAR-only (using EJB3.1). The build is based on Maven. I just read about a new possibility to order the module initialization in Java EE 6 here which i also need for my application. Also, i would like to have an option to define some EJB properties in XML. Since the example is deployed as an EAR-project the order is defined in the application.xml. But in a WAR-deployed project, there is no application.xml.

Select MAX timestamp with JPA2 Criteria API

岁酱吖の 提交于 2019-12-20 16:23:16
问题 So my entity has: @Column(name="TS", nullable=false) private java.sql.Timestamp timestamp; My generated MetaModel has: public static volatile SingularAttribute<MyEntity,Timestamp> timestamp; I want to select by the Max Timestamp value: Root<MyEntity> root = query.from(MyEntity.class); Expression maxExpression = cb.max(root.get(MyEntity_.timestamp)); But I am not allowed because: max(Expression<N> x) Create an aggregate expression applying the numerical max operation. <N extends java.lang

Configure Java EE 6 for dev/QA/prod

核能气质少年 提交于 2019-12-20 11:35:58
问题 I have a Java EE 6 app that I build with Maven, code in NetBeans 7 and deploy on GlassFish 3.1.2. As I near completion, I find myself deploying demo builds. The problem is that I don't have any dead easy way to build for different environment such as dev, QA, demo, prod, etc. For some stuff, I've been using a Java class with a bunch of static getters that return values based on the value of an environment constant. But this doesn't help me with conditionally setting javax.faces.PROJECT_STAGE

Java EE 6 - Embedded container EJB tests

≡放荡痞女 提交于 2019-12-20 10:57:16
问题 This questiong is regarding Java EE 6 , using glassfish v3 embedded-all . I have a unit test that uses EJBContainer to test my stateless EJB. Problem is I'm having trouble looking up the EJB (remote) using JNDI: setup() { ctx = EJBContainer.createEJBContainer().getContext(); } ... test() { BookService bookService = (BookService)ctx.lookup("java:global/BookServiceEJB!com.something.service.BookService"); ... } @Stateless public class BookServiceEJB implements BookService { ... } @Remote public

Explicite Local EJB not injected with Arquillian

a 夏天 提交于 2019-12-20 10:44:57
问题 I use Arquillian to test an stateless session bean that has an explicit local and remote interface. But in the test Arquillian does not "inject" anything in a field that has the type of the local interface, but it works for the remote interface. @Stateless public class TestServiceImpl implements TestServiceLocal, TestServiceRemote { public String greet() { return "hallo"; } } The remote interface: @Remote public interface TestServiceRemote { public String greet(); } The locale interface:

Excluding fields in JAXB

三世轮回 提交于 2019-12-20 09:57:23
问题 I have 2 classes: @XmlRootElement public class A { private Long id; private B b; // setters and getters } and @XmlRootElement public class B { private Long id; private String field1; private String field2; // setters and getters } By default, if I transform an instance of class A to the XML, I will have all its fields ( id ) and the referenced B class fields ( id , field1 , field2 ) like this: <a> <id>2</id> <b> <id>5</id> <field1>test1</field1> <field2>test3</field2> </b> </a> Is is possible