This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 92989 - Stateless session bean should require an interface..
Summary: Stateless session bean should require an interface..
Status: NEW
Alias: None
Product: javaee
Classification: Unclassified
Component: EJB (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Tomasz Slota
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-22 21:47 UTC by Inderjeet Singh
Modified: 2007-02-13 10:00 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Inderjeet Singh 2007-01-22 21:47:44 UTC
I wrote an EJB class without defining a business interface and NetBeans did not
complain. However, this is a violation of the EJB spec since the bean provider
must provide the business interface and attach it to the bean class (by using
annotation or through implementing the interface). 

Here is the class that compiles and works fine as an EJB module: 

package com.sun.javaee.blueprints.sessionfacade.model;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class CatalogFacadeBean {
    
    @PersistenceContext(unitName="CatalogPu")
    private EntityManager em;
    
    public void addItem(Item item) throws InvalidItemException{
        if(item.getName().length() == 0) throw new InvalidItemException("The item" +
                " name cannot be empty. Please specify a name for the item. ");
        em.persist(item);
    }
    public Item getItem(int itemID){
        Item item =  em.find(Item.class,itemID);
        return item;
    }
    
    public List<Item> getAllItems(){
        List<Item> items = em.createQuery("SELECT OBJECT(i) FROM Item
i").getResultList();
        return items;
    }
}
Comment 1 Martin Adamek 2007-01-30 13:44:24 UTC
Did you create that EJB using NetBeans wizard? If yes, it is a bug in wizard.
But anyway, the warning is missing in the editor because verification module
which is still not migrated to the new Java infrastructure is disabled in daily
builds.
Comment 2 Martin Adamek 2007-02-12 07:26:47 UTC
I think this should be tracked under verification module.
Comment 3 Tomasz Slota 2007-02-13 10:00:12 UTC
The Java EE Verification module is not supposed to be able to find 100% problems detectable by static 
analysis. We are trying to increase coverage focusing on checks most useful to the users. 


Changing issue type to "enhancement".