JPA: difference between @JoinColumn and @PrimaryKeyJoinColumn?

What happens if I promote the column to be a/the PK, too (a.k.a. identifying relationship)? As the column is now the PK, I must tag it with @Id (…). This enhanced support of derived identifiers is actually part of the new stuff in JPA 2.0 (see the section 2.4.1 Primary Keys Corresponding to Derived Identities … Read more

How to convert map to url query string?

The most robust one I saw off-the-shelf is the URLEncodedUtils class from Apache Http Compoments (HttpClient 4.0). The method URLEncodedUtils.format() is what you need. It doesn’t use map so you can have duplicate parameter names, like, a=1&a=2&b=3 Not that I recommend this kind of use of parameter names.

Stateless and Stateful Enterprise Java Beans

Stateless Session Beans (SLSB) are not tied to one client and there is no guarantee for one client to get the same instance with each method invocation (some containers may create and destroy beans with each method invocation session, this is an implementation-specific decision, but instances are typically pooled – and I don’t mention clustered … Read more

Just what is Java EE really? [closed]

Why can’t the libraries function outside of the application server environment? Actually they can. Most of the libraries can be directly used standalone (in Java SE) or included in a .war (practically that’s nearly always Tomcat). Some parts of Java EE, like JPA, have explicit sections in their respective specifications that tells how they should … Read more

Maven2: Best practice for Enterprise Project (EAR file)

You create a new project. The new project is your EAR assembly project which contains your two dependencies for your EJB project and your WAR project. So you actually have three maven projects here. One EJB. One WAR. One EAR that pulls the two parts together and creates the ear. Deployment descriptors can be generated … Read more

what is the difference between a portlet and a servlet?

Enhanced from Source: Servlets Vs Portlets Similarities Servlets and Portlets are web based components which use Java for their implementation. Portlets are managed by a portlet container just like servlet is managed by servlet container. Both static and dynamic content can be generated by Portlets and Servlets. The life cycle of portlets and servlets is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)