java - EJB Glassfish v3.1.2 client passed data to session bean is always null -
i having problem when calling session bean method passing method parameters client
application, data reaches method call null or set default value.
while process of method works object
for example:
-we have method persist object entity addstudent(student student); - client create student object setting student fields student name , on, calling method addstudent(ourstudent); ourstudent reaches method fields of null or default value. student added these empty fields.
thanks in advance.
you using eclipselink weaving, , doesn't work. should try without weaving. editing persistence.xml(s)
<persistence-unit name="xxx" transaction-type="xxx"> <jta-data-source>xxx</jta-data-source> <jar-file>or list of classes or else</jar-file> <properties> [other properties] <property name="eclipselink.weaving" value="false"/> </properties> </persistence-unit> update: there several alternative ways jpa implementation handle entities, none exhausting list:
- extension (this way jpa spec requires none private default constuctor entities)
- wrapping
- byte code manipulation of class (to make conform how eclipselink "wants" be)
- threadlocal proxy thingie
- basic reflection using properties
- basic reflection using getters setters (if there any)
eclipselink calls byte code injection "weaving" ( what java bytecode injection? ) dynamic weaving doing weaving @ "runtime" - when class loaded class loader. static weaving doing weaving before deployment, after compilation. eclipselink weaving fastest method performance wise, prefered method other reasons. unfortuneatly bit tricky weaving work. possible none of matters project, doesn't lot of typical projects.
if there clients access beans via remote interface, , there entities passed arguments or returns value through connection dynamic weaving won't work. in production scenarios, if app/product isn't small static weaving prefered on dynamic weaving anyways ... read more static vs dynamic weaving , how configure haven't found excellent sources, 1 @ least semi official: using_eclipselink_jpa_weaving
what happening entity weaved @ 1 end , not weaved @ other -> can absolutely not work.
the news don't have care of weaving thing @ all, or might. when disabled weaving, eclipselink fell method handling jpa entities. there functions eclipselink supports if weaving enabled (none jpa required though).
from: what_you_may_need_to_know_about_weaving_jpa_entities comes list of things eclipselink explicitly uses weaving for:
- lazy loading (indirection)
- change tracking
- fetch groups
- internal optimizations
(for of them there fallbacks other methods if weaving disabled, i'd guess "internal optimizations")
Comments
Post a Comment