Friday, May 18, 2012

Problems with GWT serialization logic (in a case of RPC)

Hello!

Most recently, I encountered a rather strange situation. The problem
lies in the fact that GWT refuses to serialize the parent class of my
DTO-entity,
despite the fact that the main object he successfully serialize and
then adds it to the whitelist RPC.

Because of this, obviously, some of the fields emitted essentially
because reflective getDeclaredFields() is invoked only for a main
class,
and a parent class for some reason considered as banned.

Trying to solve this problem, I came to the decision only on the
server side by writing custom serialization policy, and then
everything was seemingly
normal. But then, suddenly, another problem, namely the difference
between the CRC meta-data on the client and server as a client of the
fields were still not included.

And now I'm a little confused what to do next and where to look for
the solution....

The project structure is as follows:
Framework ->
persistence ->
Peristence.gwt.xml
Project ->
domain ->
Domain.gwt.xml <- Persistence.gwt.xml
web ->
App.gwt.xml <- domain

The assembly is carried out through the Maven GWT.

P.S
1. Using AbstractDTO as return value for a method of service does not
lead to visible improvements
2. All depending on the module are specified correctly
(<compileArtifactSource/>)
3. All dependencies are published as a source-jars, and they certainly
have needed to compile the entity.
4. At first I thought that the problem is due to the indirect
dependence "web" of the "persistence", but the direct addition of the
latter as <inherits> - did not help.
5. All entities are Serializable
6. Implement IsSerializable for AbstractDTO - not an option, because
persistence does not need to know about GWT

Subject entities have a structure like the next one:

==================
Entity -> JPA entity (provides as a <super-source/> item)

<persistence module>

interface IDTO extends Entity, Serializable {

public Long getId();

public void setId( Long id );

}

public abstract class AbstractDTO extends IDTO {

private Long id;


public void setId( Long id ) {
this.id = id;
}

public Long getId() {
return this.id;
}
}

File: *Persistence.gwt.xml*
<module>

<source path="persistence"/>

</module>

</persistence module>

<domain module>

public interface ICategoryDTO extends IDTO {
public String getName();

public void setName( String name );
}

public class CategoryDAO extends AbstractDTO implements ICategoryDTO {

private String name;

public void setName( String name ) {
this.name = name;
}

public String getName() {
return this.name;
}

}

File: *Domain.gwt.xml*
<module>

<inherits name="com.somename.Persistence" />

<source path="persistence"/>

</module>

</domain module>

<web module>

@RemoteServiceRelativePath("../rpc/main.do")
public interface ApplicationAccessService extends RemoteService {
public AbstractDTO loadCategories();
}

File: *Web.gwt.xml*

<module rename-to="Application">
<inherits name='com.google.gwt.user.User' />
<inherits name="com.google.gwt.rpc.RPC"/>

<inherits name='com.google.gwt.inject.Inject'/>

<inherits name="com.somename.Domain"/>

<!-- Specify the app entry point class. -->
<entry-point class='com.somename.Application' />

<source path="client"/>

<source path='service'/>

<super-source path="client/jre"/>


</module>


</web module>

==================================

Guys, help me, please!
Thanks!

Cyril.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate