tag:blogger.com,1999:blog-7747481246630004369.post2240924040536678615..comments2022-03-02T22:07:49.417-05:00Comments on Java Persistence: Testing EclipseLink JPA applications in JavaSEDoughttp://www.blogger.com/profile/02383574560699818383noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-7747481246630004369.post-53743339939555212132009-02-09T08:55:00.000-05:002009-02-09T08:55:00.000-05:00Doug,thanks for the fast reply. And I think you ar...Doug,<BR/><BR/>thanks for the fast reply. And I think you are right, its not part of the spec, but I need this for one of our project where we know the entity classes only at runtime, and therefore I just can't add them to the persistence.xml.<BR/>Anyway, I was able to find a way to manipulate the persistence.xml at runtime. I tried to document the attemp here : <BR/><BR/>http://java.randgestalten.de/?p=82<BR/><BR/>Basically, I wrote a WrapperArchive that intercepts attemts to get an InputStream to the persistence.xml and than manipulate that stream. I know, I know, this might break with upcoming releases, but works for me for the moment and might come in handy when writing tests in SE environment.<BR/><BR/>thassoAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7747481246630004369.post-79920284157073811402009-02-07T11:48:00.000-05:002009-02-07T11:48:00.000-05:00Thasso,Given the increasing quantity of examples I...Thasso,<BR/><BR/>Given the increasing quantity of examples I have around I just always find it easier to list the classes in the persistence.xml so that I don't have to worry about auto-detction finding more classes then I expect. I will dig further into the auto-detection algorithm and see if we can better document it.<BR/><BR/>I do not believe any auto-detection is covered for SE usage in the JPA 1.0 specification.<BR/><BR/>DougDoughttps://www.blogger.com/profile/02383574560699818383noreply@blogger.comtag:blogger.com,1999:blog-7747481246630004369.post-87355854443505615622009-02-07T10:44:00.000-05:002009-02-07T10:44:00.000-05:00Hi,I was just wondering. Are you sure about the dy...Hi,<BR/><BR/>I was just wondering. Are you sure about the dynamic entity discovery in a SE environment. I was just trying it, but I end up with a bunch of <BR/><BR/>Caused by: java.lang.IllegalArgumentException: Object: ... is not a known entity type<BR/><BR/>exceptions. If I specify the classes directly in my persistence.xml, my test successfully runs through, so it seems that my basic setup is ok and the dynamic discovery is just not working ?!?!<BR/><BR/>cheers,<BR/><BR/>thassoUnknownhttps://www.blogger.com/profile/00604386012373374976noreply@blogger.comtag:blogger.com,1999:blog-7747481246630004369.post-55808318318118452032008-12-21T12:02:00.000-05:002008-12-21T12:02:00.000-05:00hello help please.to create Persistence.createEnti...hello help please.<BR/><BR/>to create Persistence.createEntityManagerFactory with different properties does not receive the changes<BR/><BR/>code<BR/>Map properties = new HashMap(); <BR/> <BR/> properties.put("eclipselink.target-database", "MySQL4" );<BR/> properties.put("eclipselink.jdbc.driver", "com.mysql.jdbc.Driver" );<BR/> properties.put("eclipselink.jdbc.url", "jdbc:mysql://localhost:3306/tramisaludprototipo2");<BR/> properties.put("eclipselink.jdbc.user", "root");<BR/> properties.put("eclipselink.jdbc.password", "root");<BR/> <BR/> emf = Persistence.createEntityManagerFactory("com.change.date",properties);<BR/> em = emf.createEntityManager();Hasleyhttps://www.blogger.com/profile/13204582806205168493noreply@blogger.com