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 54758 - IDE should create rigth methods in the bean class
Summary: IDE should create rigth methods in the bean class
Status: CLOSED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Code (show other bugs)
Version: 4.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: Martin Adamek
URL:
Keywords: UI
Depends on:
Blocks:
 
Reported: 2005-02-09 16:57 UTC by Petr Blaha
Modified: 2006-03-24 13:09 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Blaha 2005-02-09 16:57:27 UTC
[Build 20050208]
Steps:
1) create bean 
2) select bean in logical view and invoke Add |
Create method
3) change method name to MethodCreate1
The home is created instead of create method:

public test.BMPLocal
ejbHomeMethodCreate1(java.lang.String param1)
throws javax.ejb.CreateException {
           //TODO implement ejbHomeMethodCreate1
       }
Comment 1 Martin Adamek 2005-02-10 20:31:02 UTC
As the EJB 2.1 spec (10.6.4 and 12.2.3) says:
The entity bean class must implement the ejbCreate<METHOD> methods
that correspond to the create<METHOD> methods specified in the entity
bean's home interface.
It means, create method must always start with "create" prefix.
Comment 2 Petr Blaha 2005-02-14 11:08:51 UTC
The IDE should generate right methods in bean class, e.g. when user
create select method METHOD1 then the ejbSelectMETHOD1 must be
generated in abstract class and in DD
Comment 3 Martin Adamek 2005-02-17 12:13:25 UTC
I need to discuss this issue with HIE, what is the best way to force
user to write method name in given format (ejbSelect<REST-OF-NAME>)
Comment 4 jrojcek 2005-03-02 15:22:24 UTC
Okay, based on the discussion we had I  propose to do a basic and simple solution with 
inline error messages and disabling the OK button if the name provided by the user 
doesn't match the required name pattern.

Lets use this inline error messages for method types...

Select method must start with "ejbSelect" prefix.
Create method must start with "create" prefix.
Finder method must start with "find" prefix.

John (Geertjan) please check that it is in English.

For every method type that requires a certain prefix the default value should have only the 
portion, which is possible to change, selected. For select method the default name would 
be something like:

"ejbSelectByColumn" where only "ByColumn" is selected so that if the user starts typing she 
doesn't modify the prefix.

For other methods it would be:

createBean (Bean is selected)
findByKey (ByKey is selected)
Comment 5 Martin Adamek 2005-03-10 07:45:28 UTC
Fixed. UI change!

Checking in Bundle.properties;
/cvs/j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/nodes/Bundle.properties,v
 <--  Bundle.properties
new revision: 1.2; previous revision: 1.1
done
Checking in MethodCollectorFactory.java;
/cvs/j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/nodes/MethodCollectorFactory.java,v
 <--  MethodCollectorFactory.java
new revision: 1.2; previous revision: 1.1
done
Checking in MethodCustomizer.java;
/cvs/j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/nodes/MethodCustomizer.java,v
 <--  MethodCustomizer.java
new revision: 1.5; previous revision: 1.4
done
Comment 6 John Jullion-ceccarelli 2005-03-10 09:57:24 UTC
The english is fine. Thanks for the heads up. Please mark all UI bugs with the
UI keyword so we can search for them.
Comment 7 Nikolay Molchanov 2005-03-11 17:53:46 UTC
Unfortunately there is a minor problem with the latest fix for this issue.
Last line in file Bundle.properties was added without linefeed. 

bash-2.05$ cd j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/nodes/
bash-2.05$ tail -1 Bundle.properties
LBL_MethodName_Empty_Error=Specify method name.bash-2.05$

We have automated process, that integrates changes from CVS repository 
to TeamWare workspaces (where files are under SCCS control), and SCCS 
utilities treat file as "binary", if there is no linefeed at the end 
of file. So, originally file Bundle.properties was checked in as "text",
and now 'sccs delta' cannot update file, because it cannot change type
of file. We can find a workaround, but the easiest way is to fix this
problem in CVS repository.

Please, add linefeed to the end of file Bundle.properties (or let me know
if this is undesired or impossible, and I'll implement a workaround).

Thanks in advance,
Nikolay Molchanov (Nikolay.Molchanov@sun.com)
Comment 8 Martin Adamek 2005-03-11 20:21:24 UTC
Done. Thanks for info!

Checking in Bundle.properties;
/cvs/j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/nodes/Bundle.properties,v
 <--  Bundle.properties
new revision: 1.3; previous revision: 1.2
done
Comment 9 Petr Blaha 2005-03-15 15:52:10 UTC
[Build 20050314]