java-ee

JRockit vs HotSpot classloading issue - META-INF/services

According to the javadoc of javax.xml.validation.SchemaFactory#newInstance, I can specify which implementation of SchemaFactory I want, by placing a file in META-INF/services called javax.xml.validation.SchemaFactory with the required class (in my case org.apache.xerces.jaxp.validation.XMLSchemaFactory). This works fine when I run Weblo...

Why shouldn't I use a JSF SessionScoped bean for logic?

Hi I'm developing a java EE web app using JSF with a shopping cart style process, so I want to collect user input over a number of pages and then do something with it. I was thinking to use an EJB 3 stateful session bean for this, but my research leads me to believe that a SFSB is not tied to a client's http session, so I would have to...

How do I access EJB bean when inside a custom Converter

This converter is called from my JSF. I already register it inside faces-config.xml public class ProjectConverter implements Converter{ @EJB DocumentSBean sBean; @ManagedProperty(value="#{logging}") private Logging log; public ProjectConverter(){ } public Object getAsObject(FacesContext context, UICom...

How to Assign a JPQL query to a simple Java object?

I need to assign the result of a jpql result to a simple class java object I have something like this class myObject() { @id private Long id; private String Name; private String description; ... //getters and setters } I need to somehow to store the result of this SQL query, example // could be anytable SELECT DISTINCT c.table_i...

Best way to deploy on Glassfish V3

What is the best way to deploy my web project (or ear project) to remote server and glassfish? How to use ant-deploy.xml and build-impl.xml that netbeans create for this purpose? Using autodeploy folder and separately adding sun-resources.xml to the GF Or Using ant and.... Would you please explain me step by step? Regards ...

Exception in Form authentication with Glassfish v3

I have seen this question posted many places but there seems not to be a solution for it. Therefore, I test my luck trying it here. I am using Glassfish 3.0.1 b.22 with Java EE 6 framework. Here is my form authentication inside Login.jsf <form action="j_security_check"> <h:panelGrid columns="2" bgcolor="#eff5fa" cellspacing=...

Enterprise application development-RMI and EJB

I am new to enterprise applications. Just started to learn EJB. I know RMI well. Can anyone map RMI with EJB to understand the basic strongly else give some links/books to clearly understand EJB basics. ...

EJB3 Caching Instance Variables

Hi, I've noticed some strange code on a project I am working on - its a SLSB EJB3, and it uses a private instance variable to maintain a cache of data (it even calls it dataCache or something), with a getter/setter. For EJB2 and bellow, this was a typical EJB antipattern - SLSBs are not meant to retain state in between invocations, ther...

Java EE + GlassFish: Force user to logout if he/she log in somewhere else

I hope my question on the title make sense, if not, let say: machine A, via the web browser I log in as admin, I go to machine B, and log in as admin, the web browser in machine A should force a logout on user admin. I gave this some thought, and I think it will be ugly if I try to manual implement this. I have a feeling that this can be...

Is Class.forName prohibited inside the J2EE container in general and weblogic in particular?

I have performance problem while doing first API call to my J2EE applications. So I wanted to do Class.forName to preload the classes while doing application initialization. But I heard that it is prohibited by J2EE standard/BEA implementation (I might be completely wrong). Is it so? Are there any other limitation of doing forName in J2E...

Hibernate & EhCache: net.sf.ehcache.Statistics not populated?

I think my Hibernate (3.5.3) Second Level Cache is well configured with EhCache (2.2). At least, I observe following log entries: 20:15:28 DEBUG [net.sf.ehcache.Cache#searchInStoreWithStats] persistence.unit:unitName=#pu-pay.c.u.p.model.ActionCache: persistence.unit:unitName=#pu-pay.c.u.p.model.Action store hit for c.u.p.model.Action#T...

JPA Query optimization by avoiding JOIN to lookup table?...

Imagine a table emp: CREATE TABLE emp ( id NUMBER , name VARCHAR , dept_code VARCHAR ) and a table dept: CREATE TABLE dept ( code VARCHAR , name VARCHAR ) emp.dept_code references dept.code as a ForeignKey. These tables are mapped to JPA Entities, and the ForeignKey is modeled as an association...

Sun Certified Enterprise Architect Exam Crash Course

I decided to test the theory that work expands to fill the time given and give myself as little time as feasible to complete my preparation for this exam. My appointment is in exactly one week and I started preparing yesterday. I have a lot of experience designing web-centric applications but not that much in the way of EJB. My goal is t...

Static Object in Jboss using EJB3

hi all, is it possible to create something like static object using EJB3 in Jboss. in other words i need to create something like a static object using singleton pattern or something like that, that is because i need to preload a configuration from database and i want that every bean that jboss creates uses this class to read this config...

Composite Foreign Key lost in merge() operation (JPA/Hibernate)

Imagine an Employee Entity that references a Department using a Compound Key: @Entity public class Employee { ... @ManyToOne @JoinColumns({ @JoinColumn(name="dept_country", referencedColumnName="country"), @JoinColumn(name="dept_id", referencedColumnName="id") }) private Department dept; ... In a Stateles...

The mappedName is always the same across application servers?

I have a stateless bean with some properties: It's a EJB3 class AddressFacade implements AddressFacadeRemote it's inside a ejb-jar (MyJAR.jar) it's in a EAR (MyEAR). My application server (Weblogic) generated this name (jndiName/mappedName): MyEARMyJAR_jarAddressFacade_AddressFacadeRemote I can't use injection, so I'll make a look...

JSF + Stateless EJB performance

Hey there, I have a JSF 2.0 application running on GlassFish v3. It has EJBs that serve database data via JPA for the main applications sessions. Even on non-IDE app-server, the EJB calls are very slow. Between some pages, the user has to wait over 10 seconds to get to the next page. The EJB runs on the same application server, and onl...

platforms for large software projects (OSGi or alternatives?)

They is kind of an open-ended question. Anyways, here at work we've got a few very large Java EE software projects. Here's a quick description of our projects: They are divided into a few dozen Maven projects. Some of those projects change on every release; others don't change for months. All are Maven/Spring-driven. Is OSGi the ri...

Route to study Java EE and associated technology?

I am an undergraduate student with knowledge of core Java. I want to learn Java EE and related technology for my final year major project and career prospect. what are the Prerequisites for Java EE? I and my friend have done some research on this matter. We found that we need to know about Servlets, JSP, Javabeans, RMI, etc. We have ba...

Testing EJB2.1 to EJB3 migration

We would like to migrate an application written using EJB2.1 beans (both Entity and Sessions beans) to EJB3 to improve on maintanance and use new features in the EJB3 spec. How would we do the migration and give the users the guarantee (if any) that the migrated system still works just as the old one. The original app didn't have test c...