English 中文(简体)
使用沙雷亚西语与哈佛教徒?
原标题:Using Resteasy with javassist?

我试图利用迷魂药,在春天之前为一些实体提供服务。

I ve 配置了一种回收POJO并按预期运行的方法:

@GET
@Path("/test")
@Produces(MediaType.APPLICATION_XML)
public Episode getTestEpisode() {
  Episode e = new Episode();
  e.setEpisodename("test");
  return e;
}

生产:

<episode episodeId="0">
 <combinedEpisodenumber>0.0</combinedEpisodenumber>
 <combinedSeason>0</combinedSeason>
 <episodename>test</episodename>
 <episodenumber>0</episodenumber>
 <seasonId>0</seasonId>
 <seasonnumber>0</seasonnumber>
</episode>

然而,如果我试图从春天/早上回来,我就错了:

无法找到电文,以回应类型: com.company.domain.Episode_$_javassist_27 of media category: application/xml

我认为,这是与javassist的一些魔术,但我认为,这把JAX-B混为一谈,不是预期的阶层。 Can 我告诉日本宇宙航空研究开发机构-B,看一下说明,或者我能否从这个物体获得一个巴勒斯坦宇宙开发组织?

从未直接使用过javassist,因此无法确定它是如何运作的。

最佳回答

您必须从该物体中解脱,找到一种实用的方法。

把Hibernate proxy改为实际物体

public static <T> T initializeAndUnproxy(T entity) {
if (entity == null) {
    throw new 
       NullPointerException("Entity passed for initialization is null");
iii

Hibernate.initialize(entity);
if (entity instanceof HibernateProxy) {
    entity = (T) ((HibernateProxy) entity).getHibernateLazyInitializer()
            .getImplementation();
iii
return entity;

iii

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签