java-ee-6

@ManyToOne(updatable=false) - how it should work?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 12:24:55
问题 I want to have a read-only functionality in one of my entities. I know that in JPA 2.0 we don't have such functionality per se. I thought we can achieve it using updateable=false, insertable=false but I don't think I get how it works. Assume that I have two entities: OrderedItem and Customer : @Entity public class OrderedItem { @Id @GeneratedValue private int id; private String name; @ManyToOne @JoinColumn(updatable = false) private Customer owner; // bunch of simple getters and setters }

Servlet 3.0 logout doesn't work

女生的网名这么多〃 提交于 2019-12-12 12:08:29
问题 I've got a problem with the authentication features of Servlet 3.0: With this code in a Servlet v3: log.info(""+request.getUserPrincipal()); log.info(""+request.getAuthType()); log.info("===^==="); request.logout() ; log.info(""+request.getUserPrincipal()); log.info(""+request.getAuthType()); request.authenticate(response) ; log.info("===v==="); log.info(""+request.getUserPrincipal()); log.info(""+request.getAuthType()); I would always expect to see the Username/login windows, because of the

Migrate data from relational DB to NoSQL

南笙酒味 提交于 2019-12-12 11:05:39
问题 Is it possible/are there tools/ best practices etc to migrate data to a NoSQL format from a relational DB. I have a JEE6 app making use of Hibernate ORM to persist to MySQL but now we wish to move to NoSQL solution but need to bring the existing data with us Thanks W 回答1: There are some tools to help the migration, but in the end, MySQL is a relational database which has a completely different structure from noSQL databases. In the end, you will almost always have to do these four steps

JMS Timeout or TimeToLive

风格不统一 提交于 2019-12-12 09:56:51
问题 I am fairly new to Java EE and JMS and am looking at doing an implementation using JMS. Think of the following scenario: Scenario A user hits a servlet. A message is then put into a JMS server/Queue from this servlet. A response is then sent back to the user saying "Message Queued". Option 1 The consumer/MDB receives the message from the JMS queue and processes it. This is normal operation and pretty standard. Option 2 There is no consumer(for what ever reason) or the receiver is processing

Auto-reload changed files in Java

一曲冷凌霜 提交于 2019-12-12 08:07:17
问题 I have a lot of configuration files that modify how my application behaves. I want to be able to make a change and it gets reflected in the application right away when saving the file. Is there a Java library to help with this? I could simply keep a list of files with their timestamps and continuously check in a background thread when a timestamp changes. Doesn't seem too difficult, but maybe there's a more efficient way to do this? Custom triggers when certain properties have changed would

Is there something analogous to Springs @Transactional annotation available in Java EE 6?

北战南征 提交于 2019-12-12 08:05:37
问题 In my company the usage of the Spring framework is discouraged and instead Java EE 6 is promoted. But recently I read about Springs @Transactional annotation at Using @Transactional and think this could be really useful for our code. As far as I understand a method annotated with @Transactional will either reuse an already existing transaction or open up a new transaction if no active transaction exists when calling that method. Is there something analogous (e.g. a similar annotation)

Multi tenancy support in Java EE 6

假装没事ソ 提交于 2019-12-12 07:46:35
问题 I have an existing Java EE 6 application (deployed in Glassfish v 3.1) and want to support multiple tenants. Technologies/APIs I'm currently using in my app are EJB (including the EJB timer service) JPA 2.0 (EclipseLink) JSF 2.0 JMS JAX-RS I plan to use CDI as well As far as I know, adding multi-tenancy support affects only the persistence layer. My question: Has anybody done this before? What are the steps to convert the application? Will this affect other layers other than persistence?

Combining spring and Java EE

情到浓时终转凉″ 提交于 2019-12-12 06:46:55
问题 We have two modules in our project app-ui and app-services . app-ui is a portlet project follows spring based implementation and app-services has restful and soap services follows Java EE 6 based implementation. We want to enable security, logging and exception handling aspects through out the modules. We face the following problems: Spring aop works well only in app-ui. In app-services side we tried using Load-Time Weaving and spring-bridging but did not succeed, it works successfully only

Select certain CDI event observer

房东的猫 提交于 2019-12-12 06:17:11
问题 I have a few classes that observe some CDI event. Is it possible to declare which class should be used in different cases? For example I have class that produce events: class Producer { @Inject private Event<SomeEvent> event; public void fire() { event.fire(new SomeEvent()); } } And I have two consumer classes: class ConsumerA { public void onEvent(@Observes SomeEvent event); } class ConsumerB { public void onEvent(@Observes SomeEvent event); } How can I use ConsumerA instances in one case

Newbie: Web.xml Eclipse. xsi:schemaLocation & xmlns:web

拜拜、爱过 提交于 2019-12-12 04:47:12
问题 2.5 xsd and 3.0 xsd. Why there are 2 xsd? Project Spec: Server info: Apache Tomcat/7.0.27 Servlet version: 3.0 JSP version: 2.1 Java version: 1.6.0_32 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">