Life is like Code, you never know what you will create next

[class E] uses a non-entity [class E] as target entity in the relationship attribute [field

6. March 2012 07:52 by Scott in Java  //  Tags: ,   //   Comments (0)

[class E] uses a non-entity [class E] as target entity in the relationship attribute [field

Busted in upon this error and didn’t find much for it online.

Its mainly caused because the Entity is not found in the persistance.xml document.  You have to make sure its added.

Java JPA Doesn’t Show Updates to tables

15. September 2011 17:21 by Scott in   //  Tags: , , ,   //   Comments (27)

There was a problem one of my peers found with Java JPA that got him stuck for a few hours.  He told me to blog about it so here it is.

When you use the JAVA JPA library.  You will pull results from the database.  That’s exactly what the JPA lib does.  Its like LINQ, but for Java.

So here is the problem.  When pulling results from the JPA objects from the database, the JPA then caches all the objects.  So every time after that, the cached results get returned instead of the most important information just placed in the Database.  So, in order to get around this, you must call the “refresh” method.  Or at least that’s what he told me to say.  That method will then hit the DB again for another round trip and update all the objects on the JPA side.

That is all.