I am having a problem when calling session bean method passing method parameters from client
application, the data reaches the method call is always null or set to default value.
while the process of the method works well with the object
for example:
-we have method to persist an object entity addStudent(Student student); - from the client we create the student object setting student fields like student name and so on, calling the method addStudent(ourStudent); this ourStudent reaches method with fields of null or default value. the student is added with these empty fields.
Thanks in advance.
You are using EclipseLink with weaving, and it doesn't work. You should try without weaving. Probably by editing your
persistence.xml
(s)Update: There are several alternative ways a JPA implementation could handle entities, this is a none exhausting list:
EclipseLink calls byte code injection "Weaving" ( What is Java bytecode injection? ) Dynamic weaving is doing the weaving at "runtime" - basically when the class is loaded by a class loader. Static weaving is doing the weaving before deployment, but after compilation. For EclipseLink weaving is the fastest method performance wise, it is also the prefered method for other reasons. Unfortuneatly it is often a bit tricky to get weaving to work. It is fully possible none of that matters for your project, it doesn't for a lot of typical projects.
If there are clients that access beans via an remote interface, and there are entities passed as arguments or returns value through that connection dynamic weaving won't work. In most production scenarios, especially if the app/product isn't very small static weaving is prefered over dynamic weaving anyways ... To read more about static vs dynamic weaving and how to configure it I haven't really found any excellent sources, but this one is at least semi official: Using_EclipseLink_JPA_Weaving
What was happening to you was that the entity was weaved at one end and not weaved at the other -> can absolutely not work.
The good news is that you probably don't have to care about any of this weaving thing at all, or you might. When you disabled weaving, EclipseLink fell back to another method for handling the JPA entities. There are some functions EclipseLink only supports if weaving is enabled (none JPA required though).
From: What_You_May_Need_to_Know_About_Weaving_JPA_Entities Comes a list of things that EclipseLink explicitly uses weaving for:
(For some of them there are fallbacks to other methods if weaving is disabled, I'd guess all but "internal optimizations")