jakarta-ee

Nested @Transactional

对着背影说爱祢 提交于 2020-01-21 02:39:06
问题 Is it possible to nest @Transactional annotated methods in spring? Consider something like this: @Transactional public void a() { obj.b(); } @Transactional public void b() { // ... } What happens in such a case if I rollback in b() and rollback in a() ? 回答1: The second @Transactional annotation on method b() is not required because by default @Transactional has a propagation of REQUIRED , therefore methods called by method a() will be transactional. If you are looking to start a new

How to select the first element of a set with JSTL?

元气小坏坏 提交于 2020-01-19 02:52:05
问题 I managed to do it with the next code but there must be an easier way. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <c:if test="${fn:length(attachments) > 0}"> <c:forEach var="attachment" items="${attachments}" varStatus="loopCount"> <c:if test="${loopCount.count eq 1}"> attachment.id </c:if> </c:forEach> </c:if> 回答1: You can access individual elements with the array [] operator: <c:out value="$

Testing against Java EE 6 API

有些话、适合烂在心里 提交于 2020-01-18 21:35:53
问题 I write an addition to JAX-RS and included the Java EE 6 API as a Maven dependency. <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> Then I have a little test case: @Test public void testIsWriteable() { class SpecialViewable extends Viewable { public SpecialViewable() { super("test"); } } FreeMarkerViewProcessor processor = new FreeMarkerViewProcessor(null); assertTrue(processor.isWriteable(SpecialViewable

Testing against Java EE 6 API

北战南征 提交于 2020-01-18 21:35:30
问题 I write an addition to JAX-RS and included the Java EE 6 API as a Maven dependency. <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> Then I have a little test case: @Test public void testIsWriteable() { class SpecialViewable extends Viewable { public SpecialViewable() { super("test"); } } FreeMarkerViewProcessor processor = new FreeMarkerViewProcessor(null); assertTrue(processor.isWriteable(SpecialViewable

Testing against Java EE 6 API

人走茶凉 提交于 2020-01-18 21:35:28
问题 I write an addition to JAX-RS and included the Java EE 6 API as a Maven dependency. <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> Then I have a little test case: @Test public void testIsWriteable() { class SpecialViewable extends Viewable { public SpecialViewable() { super("test"); } } FreeMarkerViewProcessor processor = new FreeMarkerViewProcessor(null); assertTrue(processor.isWriteable(SpecialViewable

See if Alfresco Server is available

拟墨画扇 提交于 2020-01-17 06:21:31
问题 I am working with Alfresco and sometimes the server is down for low space or other problem , the thing is with my serverURL i want to check if he is available (Alfresco Server) i thought to make a ping but the adresse is to complexe for a simple ping ex : http://127.0.0.1:8084/alfresco/api/-default-/public/cmis/versions/1.0/atom I am working in a J2EE Project 回答1: Hi i want to say that the part of the answer where given by @Gagravarr public void pingADR() throws UnknownHostException,

Calendar object won't update in database but does update within session

邮差的信 提交于 2020-01-17 06:11:06
问题 I'm representing Appointments in an entity bean which have a startTime and endTime of type Calendar . This is stored using JPA as TIMESTAMP . If I edit the Appointment object's start / end time it updates on the object itself during the session but it's not updated within the database itself. Other elements such as the Appointment's description successfully update in the database.. It's only he start and end time which are not. Entity class (this is indirectly updated in the database with

Obtaining initial context from remote client

一笑奈何 提交于 2020-01-17 05:21:07
问题 Please see the code below: Context ctx = null; ctx=new InitialContext(); TestEJBRemote t = (TestEJBRemote) ctx.lookup("java:global/EJBTest/EJBTest-ejb/TestEJB"); System.out.println(t.getName("Ian")); The output is what I expect i.e. Hello Ian. The code above assumes that the client is installed on the same computer as the Glassfish instance. How do I get the same result from a remote application client. I have tried this: Context ic = new InitialContext(); TestEJBRemote t = (TestEJBRemote) ic

How to write Arquillian tests for JSF classes

杀马特。学长 韩版系。学妹 提交于 2020-01-17 04:06:23
问题 I am trying to perform arquillian tests on a data model rooted in the JSF API. I am getting this error: Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.046 sec <<< FAILURE! initializationError(mypackage.GenericLazyModelTest) Time elapsed: 0.003 sec <<< ERROR! java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/model/DataModel Simple arquillian tests, not involving JSF, but JPA and EJB APIs run fine. Researching

JSP MySQL Class.forName error

最后都变了- 提交于 2020-01-16 18:43:47
问题 I'm new to JSP. I'm trying to do a basic program of JSP & MySQL connectivity using ADT Eclipse. On running the index.jsp page, I get the following: HTTP Status 500 - An exception occurred processing JSP page /index.jsp at line 24 type Exception report message An exception occurred processing JSP page /index.jsp at line 24 description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred