I know this is a bad idea (and I should use normal JDBC for this) but if I wanted to get hold of all, say 10 records for a drop down box, from a DB without knowing the keys, how do I do it using entity EJB? TIA Dave
You would need to write a finder method and call this from the home interface of your Entity Bean. An example of a finder method is findByPrimaryKey() which is required for all Entity Beans. You can also define other finder methods (all starting with findBy) that can return either a single Entity or a multiple Entities in the form of a Collection or Set.
Why would you even want to use an entity bean to read records in the first place? Can you not use straight JDBC, or even better DAO and just hit the DB?
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).