This is great, but I think this will throw a Runtime exception if targetEntity is not specified or inexistent.