2 Replies Latest reply on Jun 1, 2009 3:47 AM by Alexey Chalov

    Remote EJB call problem

    Alexey Chalov Newbie

      I have a problem accessing generated primary key for entity when call create method through remote ejb3 interface. The piece of SLSB code is

       public T persist(T entity) {
       return entity;
       public void flush() {

      , entity
       @Column(nullable = false, name = "id")
       @SequenceGenerator(name = "CountrySequenceGenerator", sequenceName = "country_id_seq")
       @GeneratedValue(strategy = GenerationType.AUTO, generator = "CountrySequenceGenerator")
       private Long id;

      and client call
       CountryRemote countryRemote = JBossEjbLocator.getLocator().getReference(CountryRemote.class);
       CountryLocal countryLocal = JBossEjbLocator.getLocator().getReference(CountryLocal.class);
       public Long createCountryLocal() {
       Country country = new Country();
       country.setName("Test Country");
       return country.getId();
       public Long createCountryRemote() {
       Country country = new Country();
       country.setName("Test Country");
       return country.getId();

      Actually local call works fine. Generated id for country object are set when flush() called, but calls through remote interface always return null.
      When I look through database records I see that records successfully added in both cases. Calling refresh() on entity gives no result.
      JBoss AS version jboss5.0.1.GA, database PostgreSQL 8.3. JDBC3 driver used.
      Client code is called from JSF managed bean.
      What I am douing wrong? Actually, I think that there should be no difference in the way I call ejb3.
      Thanks for your answers in advance.