java-ee

Observer pattern suggestion

北城以北 提交于 2019-12-12 02:31:54
问题 I have three modules where user inserts some data using application , it is basically a j2ee application where user just creates information there are three modules .At the end of insertion i have create a status in table of the data and send email notificaiton , this is common to all the three modules , would it be better to user observer pattern here.If not what would be better?- 回答1: Better use one of the below approaches generally used for your case You can use Database triggers : http:/

How to refresh cache after persist?

半腔热情 提交于 2019-12-12 02:29:48
问题 I am using JPA (EclipseLink 2.5) for persistence. My web app contains AJAX page updates. When a post is saved, the posted content shows up without refreshing the browser. The post have tags associated with it using a OneToMany relationship. These tags are supposed to show up after save too. However, because the cache was enabled I was not able to get the tags. Here's my code: @TransactionAttribute(TransactionAttributeType.REQUIRED) public Sqask save(AskTag tags) { try { Sqask ask = saveAsk

not able to use request scope in the Spring config file

六眼飞鱼酱① 提交于 2019-12-12 02:26:58
问题 i am trying to use request scope in the spring file,but i am not able to do so, i am getting folllowing error.we are using spring security and session management.. After changing the scope I get the following error: Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (2) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'clientApp' threw exception; nested exception is org.springframework.beans.factory

Setup Connection pooling in jsp/servlets application based on MVC?

江枫思渺然 提交于 2019-12-12 02:25:00
问题 I want to use Connection pooling in my java web application with MySQL and JDBC, I found a very resource to learn at Apache Tomcat 6.0 (6.0.35) - JNDI Datasource HOW-TO, But this example uses JSTL code to explain how to retrieve connection from pool. I want to work similarly but with a MVC architecture from scratch consisting of Beans, DAOs, Servlets and JSPs. I got everything I want from a very good DAO tutorial by BalusC but I am confused in the last part of tutorial saying How about

System.Web.HttpException: Maximum request length exceeded

℡╲_俬逩灬. 提交于 2019-12-12 02:23:07
问题 I am getting above exception. I have tried many solutions from SO, which didn't work, because most of them are for asp.net . This is part of web.xml of my web app: <servlet> <servlet-name>MainPageServlet</servlet-name> <servlet-class>servlets.MainPageServlet</servlet-class> <multipart-config> <!-- 10MB of files --> <max-file-size>10485760B</max-file-size> <!-- 10KB of form data --> <max-request-size>10240B</max-request-size> <!-- Buffer to disk over 512KB --> <file-size-threshold>524288B<

Hibernate Nested Properties Alias

我是研究僧i 提交于 2019-12-12 02:15:45
问题 I have this class: @Entity @Table(name = "TOPUP_MESSAGE") public class ReportFee { //... ID & Other Properties @ManyToOne @JoinColumn(name="CONTRACT_ID") private ContractDetail contractDetail; //GETTERS AND SETTERS } and ContractDetail class is like this: @Entity @Table(name = "CONTRACT_DETAIL") public class ContractDetail { //... ID & Other Properties @ManyToOne @JoinColumn(name = "CONTRACT_ID") private Contract contract; //GETTERS AND SETTERS } My Contract class is like this: @Entity @Table

EJB properties file

自作多情 提交于 2019-12-12 02:00:15
问题 In my project I have 2 modules, a ejb and a war module. In the war module i have a properties file that is processed when I start the web application (by a listener). For each property in this properties file, i add it to the servlet context. So, my question is: is it possible to access this properties, in the servlet context, from a enterprise java bean in the ejb module? I want to do something like this, but in a ejb: ServletContext sc = myservlet.getServletContext(); String xpto = sc

EJB3: Right way to insert initial data when application starts like Grails Bootstrap?

本秂侑毒 提交于 2019-12-12 01:59:43
问题 Similar to Bootstrap.groovy in Grails, how to add some initial data when an app starts? Since in @PostContstruct method, the EntityManager is not available in Stateless session beans (or am I doing something wrong?), so what should be the right way to insert some initial data? E.g. I want to add one Admin account in my system when the application starts. 回答1: Since in @PostContstruct method, the EntityManager is not available This is not true, @PostConstruct is usually the right place where

Which jar on weblogic server/ other resources could possibly have class: oracle.security.jps.ee.http.JpsFilter?

匆匆过客 提交于 2019-12-12 01:57:02
问题 I wanted to know which jar do have this class file : oracle.security.jps.ee.http.JpsFilter Our deployment is working fine on test system, but failed on production saying class not found : oracle.security.jps.ee.http.JpsFilter We have made this entry in our web.xml, but we are not able to find the jar which is present in our test system , but not present in our production system. Please let me know possibles jar/s which might have this class : oracle.security.jps.ee.http.JpsFilter 回答1: Hi

@Schedule in Java EE doesn't start

一个人想着一个人 提交于 2019-12-12 01:53:10
问题 I'm developing a web app in java ee and i want to update the weather every x amount of time. This is the code that i want to execute every 20 seconds but it does not start, can someone explain me why? I have to call it somewhere? @Startup @Singleton public class ManageForecast implements Serializable{ private String urlQuery; private String woeid; private String cityHome; private String tempHome; private List<Location> place; private Forecast forecast; @PersistenceContext EntityManager em;