I am working with Netbeans 6.7.1 alongside a Glassfish server 2.1.
Java 1.6 is in the system
I have an enterprise application with a web application with a jsp page,
and a session bean. These guys are fine.
Now I am trying to create an Entity Bean persisting on the Derby DB
in the Glassfish server.
My Persistence Unit is "MyPu" and these are its contents :
Rooms.java, the entity bean, is this :
The real puzzle is that it compiles and it sometimes can even go with the GrandHotel.ear and
be successfully deployed, although it refuses to do any database inserts.
However when I run Verify on the Rooms module (Entity Bean) I get :
Error Name : Could not verify successfully.
Error Description : java.io.IOException: Cannot determine the Java EE module type for E:\NBProjects\Rooms\dist\Rooms.jar
I see the message : Cannot determine the Java EE module type but
I have the @Entity annotation written in Rooms.java quite clearly. This error message is rather ambiguous to me.
Does the persistence unit connect to the database and create the ROOMS table I need, or must I do that elsewhere in code?
Dan Kempten wrote:However it still does not write, although it can read records I enter by hand from another source.
It all verifies and deploys correctly but it cannot write any records.
Must there be certain values set in the persistence.xml by hand in order to
make it possible to write?
em.persist(room1); does nothing
Most probably this has to do with your configuration of transaction management. You have to open a transaction before calling persist, and commit the transaction after. You don't have to do that yourself. You Just need to do some configurations of the transaction manager. I didn't do that for EJBs since I usually use spring. I suggest that you open another thread for that.
Joined: Dec 26, 2008
>>Most probably this has to do with your configuration of transaction management
1. I found that the two interfaces for the session bean were not annotated at all and
2. also saw in an example that the entity bean was instantiated with a simple "new EntityBean()" in the JSP web app
3. After much agony I also found that I needed to annotate the session bean class with something like this :
@SomeSuch(mappedName="MyJNDIName") // I left the details at the academy
With that I could use InitialContext and lookup to instantiate the Session bean in the JSP web app.
4. I also found that one could also instantiate the POJO Entity bean within the Session Bean Class, again with "new EntityBean()",
but now I am finding that using this "new EntityBean()" three times in a row in the JSP only writes the first time into DB but
the second and third beans are ignored by the persistence mechanism. Perhaps counting to three is too much for a @Stateless bean
So it goes.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: EJB3 Entity Bean won't verify with Netbeans