java-ee-6

how create a Word document from a template or existing document with Java?

不羁的心 提交于 2019-12-06 02:00:04
I have a document template where some fields are static and others are dynamic. I need to replace some data (name, last name, salary) and generate the new file. What library do you recommend to do this? Is POI appropriate? I am working with Spring, Java EE6 and Oracle. max You can give Apache POI a try but the HWPF and XWPF part of POI which are required to manipulate word files are really complicated to use - you need to have at least a good understanding how a word file is structured! Solution using iText and PDF I did something similar with PDF (this might be an option for you) 1) You can

how to call stored procedure with multiple in and out parameters using entity manager

一世执手 提交于 2019-12-06 00:53:06
问题 We are facing an issue while calling the stored procedure from the application. The database is oracle 10g This proc has 2 input parameters and 2 output parameters. Input 1:- DB-List Input 2:- String Output 1:-Again a DB-List Output 2:- Number When we are trying to use Query q = session.createSQLQuery("{call proc_name(?,?,?,?)}"); We cannot distinguish between in parameters and out parameters. So how should we handle it by using this. Also, We tried to use callable statement as follows:

Learning resource for Configuring Hibernate JPA 2.0 on Glassfish server

北慕城南 提交于 2019-12-06 00:39:44
I am trying to create a new Java EE project using hibernate and JPA 2.0 on the glass fish server. Can you guys provide me some resources to configure the above so that they work seamlessly? I have tried using netbeans and generated the persistence unit by using the hibernate provider, but I end up getting this error: javax.persistence.PersistenceException: [PersistenceUnit: DBAppPU] Unable to build EntityManagerFactory Pascal Thivent First, install Hibernate support via the update tool (or follow the manual procedure ). Second, provide a JPA 2.0 persistence.xml to use Hibernate as JPA provider

CDI - Observing Container Events

本小妞迷上赌 提交于 2019-12-06 00:18:25
问题 I am trying to observe both the startup and shutdown events for a CDI web application. I have an ApplicationScoped bean that listens for those events: @ApplicationScoped public class PrettyfacesStartupObserver { private static final Log LOGGER = LogFactory.getLog(PrettyfacesStartupObserver.class); public PrettyfacesStartupObserver() { LOGGER.debug("\n\n\n\n\n\n\n\n\n\nconstructor"); } public void onStartup(@Observes AfterBeanDiscovery afterBeanDiscovery ) { LOGGER.debug("\n\n\n\n\n\n\n\n\n

JSF get current action in managed bean

梦想的初衷 提交于 2019-12-05 23:39:23
When user clicks any commandButton , then corresponding action is called in managed bean. Is it possible to get this action name from @PostConstruct method or from event listener method ? The button's name=value pair is by itself available as HTTP request parameter the usual way. Imagine that the generated HTML representation of the command button look like this <input type="submit" name="formId:buttonId" value="Submit" ... /> Then it's present as a request parameter with name formId:buttonId with a non-null value. JSF uses exactly this information during the Apply Request Values phase to

Issue with EJB 3.1 injected with CDI bean while running JUnit

╄→尐↘猪︶ㄣ 提交于 2019-12-05 23:09:36
I created a EJB3.1 and injected CDI bean using the @inject but facing some issues while unit testing however when tested from the servlet its working fine. I have the beans.xml in the WEB-INF folder. Below is my EJB code: @Stateless public class CdiUsingEjb { @Inject private HelloServletCDIPojo helloServletCDIPojo; public String greet() { assert helloServletCDIPojo != null; return helloServletCDIPojo.from(); } } Below is my CDI bean: public class HelloServletCDIPojo { public String from() { return "from HelloServletStateless CDI"; } } I created a JUnit class: public class CdiUsingEjbTest {

How to get the source code for the javax:javaee-api-6.0.jar

限于喜欢 提交于 2019-12-05 22:14:52
问题 I use the javax:javaee-api-6.0.jar maven artifact. <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> I would like to download its source code with the dependency:sources mvn goal. I was looking for the sources in the official maven repositories, but I still can't find it. Could you give me a bit of advice on how can I achieve my object? Thank you. 回答1: Mich is correct. The purpose of the javaee-api module is

Cannot use dependency jboss-javaee-6.0 in my Maven project

江枫思渺然 提交于 2019-12-05 22:03:46
I have set up a maven project with JBoss 7.1.1 and I want to use JavaEE libraries. In the root pom.xml I have set: <repositories> <repository> <id>jboss</id> <url>https://repository.jboss.org/nexus/content/groups/public/</url> </repository> </repositories> I have this in the root pom.xml and and in the ejb maven module´s pom.xml: <dependency> <groupId>org.jboss.spec</groupId> <artifactId>jboss-javaee-6.0</artifactId> <version>3.0.2.Final</version> <scope>provided</scope> <type>pom</type> </dependency> When I do a maven clean install I get this error: Failed to execute goal on project myproject

Custom Security mechanism in Java EE 6/7 application

流过昼夜 提交于 2019-12-05 22:03:39
I would like to create (implement by my own) authentication mechanism which will be plugged into my Java EE application. As far as I know I have to implement LoginModule and connect this implementation with container mechanisms somehow. But the problem is that I don't know how to do it. Maybe You know where I can find sample code or tutorial about it? In other words I would like to force container to call my classes whenever methods: authenticate, login, and logout are called. Sample implementation : HttpServletRequest.login method will successfully authenticate only users with even numer of

JavaEE CDI in Weld: Generic Events?

佐手、 提交于 2019-12-05 21:35:12
I have an idea for a specific event handling based on generics, but seems like Weld can't handle them. I asked google but couldn't find an alternative CDI extension for this. Question : is there a CDI extension, that can handle event propagation of generic-typed events? In the following the explicit problem I have. I have three general events, EntityCreated, EntityChanged and EntityDeleted. The base class for them is defined like this: public abstract class DatabaseEvent<TargetType> { public TargetType target; public DatabaseEvent(TargetType target) { this.target = target; } } The events then