Posts Tagged ‘glassfish server’

How to reference a ejb 3.1 from another web application running in the same vm

abril 30, 2011

Given the bean :

— interface

package com.amhom.ejb.customer;

import java.io.Serializable;

import javax.ejb.Local;

@Local
public interface Customer extends Serializable {
public String getTestString();
}

— implementation

package com.amhom.ejb.customer;

import javax.annotation.Resource;
import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.sql.DataSource;

/**
* Session Bean implementation class Customer
*/
@Stateless(name=”CustomerService”)
public class CustomerBean implements Customer {
@Override
public String getTestString() {
return sayHello();
}
}

you can obtain a reference to this EJB from another webapp running on the same vm as GlassFish Server 3 writing:

Customer converter = (Customer) (new InitialContext()).lookup("java:module/CustomerService");

See also: Local Clients

Anuncios

Entity Inheritance – The Table per Concrete Class Strategy

abril 24, 2011

Qué curioso esto que se comenta en The Java EE 6 Tutorial:

The default Java Persistence API provider in the GlassFish Server does not support this strategy