Last active
August 29, 2015 13:57
-
-
Save dipold/9781039 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Type; | |
import org.hibernate.proxy.HibernateProxy; | |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonSerializationContext; | |
import com.google.gson.JsonSerializer; | |
public class HibernateProxySerializer implements JsonSerializer<HibernateProxy> { | |
@Override | |
public JsonElement serialize(HibernateProxy src, Type typeOfSrc, JsonSerializationContext context) { | |
Object deProxied = src.getHibernateLazyInitializer().getImplementation(); | |
return context.serialize(deProxied); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment