Profile cover photo
Profile photo
Ondrej Mihályi
Views/opinions are my own and independent.
Views/opinions are my own and independent.
About
Ondrej Mihályi's posts

Post has attachment

Post has attachment
A summary post about the JUG Prague event where I gave my talks.  I'm looking forward to give some other speaches after the summer. https://itblog.inginea.eu/index.php/my-recent-talks-at-jug-in-prague/

Post has attachment

Post has attachment
I will be talking at the Czech Java User Group event in Prague next week. http://hubs.ly/H03fqZV0  #Java #JavaEE #JUG #GlassFish

Post has attachment
Update on what I've been up to at @Payara_Fish https://itblog.inginea.eu/index.php/payara-update-may-2016/

Post has attachment

Post has attachment
An interview about #JavaEE with my former employer #Uniqa. Good job guys to get to Adam Bien's list of interviewes http://www.adam-bien.com/roller/abien/entry/java_ee_at_uniqa_insurance

Post has attachment
Proudly working with the Payara team.
http://www.payara.fish/welcome_to_the_payara_team_ondrej

Post has attachment
Ondrej Mihályi commented on a post on Blogger.
Helpful and although very basic, straight to the point introduction. Your other posts that go deeper are very helpful too. I found out that it is also easy to use facelets, which is my preffered view technology over JSP. I blogged about it here: http://itblog.inginea.eu/index.php/mvc-1-0-in-java-ee-8-getting-started-using-facelets/

Post has attachment
I found a solution to deproxy a class using standard Java and JPA API. Tested with hibernate, but does not require hibernate as a dependency and should work with all JPA providers.

Onle one requirement - its necessary to modify parent class (Address) and add a simple helper method.

General idea: add helper method to parent class which returns itself. when method called on proxy, it will forward the call to real instance and return this real instance.

Implementation is a little bit more complex, as hibernate recognizes that proxied class returns itself and still returns proxy instead of real instance. Workaround is to wrap returned instance into a simple wrapper class, which has different class type than the real instance.

In code:

class Address {
   public AddressWrapper getWrappedSelf() {
       return new EntityWrapper(this);
   }
...
}

class AddressWrapped {
    private Address wrappedAddress;
...
}

To cast Address proxy to real subclass, use following:
Address address = dao.getSomeAddress(...);
Address deproxiedAddress = address.getWrappedSelf().getWrappedAddress();
if (deproxiedAddress instanceof WorkAddress) {
WorkAddress workAddress = (WorkAddress)deproxiedAddress;
}
Wait while more posts are being loaded