Exclude target folder from search results in Eclipse

Mark the “target” folders as “derived” resource from the properties screen of those folders (this option is next to read only and archive property). In the quick search (Ctrl+Shift+R) screen press the arrow in the top right corner and untick “Show derived resources”. Then those target-files will not be considered in the quick search anymore.

Why do we use web.xml? [closed]

Generally speaking, this is the configuration file of web applications in java. It instructs the servlet container (tomcat for ex.) which classes to load, what parameters to set in the context, and how to intercept requests coming from browsers. There you specify: what servlets (and filters) you want to use and what URLs you want … Read more

Inject an EJB into JAX-RS (RESTful service)

I am not sure this is supposed to work. So either: Option 1: Use the injection provider SPI Implement a provider that will do the lookup and inject the EJB. See: @EJB injection. Example for com.sun.jersey:jersey-server:1.17 : import com.sun.jersey.core.spi.component.ComponentContext; import com.sun.jersey.core.spi.component.ComponentScope; import com.sun.jersey.spi.inject.Injectable; import com.sun.jersey.spi.inject.InjectableProvider; import javax.ejb.EJB; import javax.naming.Context; import javax.naming.InitialContext; import javax.ws.rs.ext.Provider; import java.lang.reflect.Type; … Read more

Hibernate/JPA ManyToOne vs OneToMany

Suppose you have an Order and an OrderLine. You can choose to have a unidirectional OneToMany between Order and OrderLine (Order would have a collection of OrderLines). Or you can choose to have a ManyToOne association between OrderLine and Order (OrderLine would have a reference to its Order). Or you can choose to have both, … Read more

I don’t have “Dynamic Web Project” option in Eclipse new Project wizard

Not all of them are required (I think), but after installing the components listed below I got the “Dynamic Web Project” template added to my Eclipse (Indigo). The list is: Eclipse Java EE Developer Tools Eclipse Java Web Developer Tools Eclipse Web Developer Tools Eclipse XML Editors and Tools You can install those packages by … Read more

persistence.xml different transaction-type attributes

Defaults Default to JTA in a JavaEE environment and to RESOURCE_LOCAL in a JavaSE environment. RESOURCE_LOCAL With <persistence-unit transaction-type=”RESOURCE_LOCAL”> you are responsible for EntityManager (PersistenceContext/Cache) creating and tracking You must use the EntityManagerFactory to get an EntityManager The resulting EntityManager instance is a PersistenceContext/Cache An EntityManagerFactory can be injected via the @PersistenceUnit annotation only (not … Read more

EJB 3.1 @LocalBean vs no annotation

The rules are (from memory): Bean has a @LocalBean annotation -> bean has a no-interface view Bean has a @Local annotation -> bean has a local view Bean has a @Remote annotation -> bean has a remote view Bean has no view annotations, but directly implements an interface which has a @Local annotation -> bean … Read more

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