When Persistence.createEntityManagerFactory() is called, the persistence implementation will search your classpath for any META-INF/persistence.xml files using the ClassLoader.getResource("META-INF/persistence.xml") method. Actually the Persistence class will look at all the Persistence Providers available in the classpath and ask each of them if they are responsible for the creation of the entity manager factory manager1. Each provider, from this list of resources, it will try to find an entity manager that matches the name you specify in the command line with what is specified in the persistence.xml file (of course the provider element must match the current persistent provider). If no persistence.xml with the correct name are found or if the expected persistence provider is not found, a PersistenceException is raised.
An entity manager factory is typically create at application initialization time and closed at application end. It's creation is an expensive process. For those who are familiar with Hibernate, an entity manager factory is very much like a session factory. Actually, an entity manager factory is a wrapper on top of a session factory. Calls to the EntityManagerFactory are thread safe.
A EntityManagerFactory is an expensive-to-create, threadsafe object intended to be shared by all application threads. It is created once, usually on application startup.
Campbell Ritchie wrote:No, you only apply the transforms to the copy object.
Arron Ferguson wrote:But then I'm faced with the entire graphics context having the transforms/translations applied to it rather than local transforms/translations.
You need a copy object regardless; you can transform and un-transform a Graphics object, but the floating-point arithmetic is never quite precise, so your Graphics will be slightly skewed afterwards. That seems to be more of a problem with rotation and shearing than scaling or translation.
And sorry for not replying earlier. And Craig Wood's code always works well, doesn't it
Craig Wood wrote:not sure whether this method is suppose to take a matrix or if it's suppose to take a set of arbitrary points
AffineTransform contains the matrix and does the matrix math in the background. The transform method takes an arry of arbitrary points (in any space) and transforms them into the space defined by the AffineTransform.
Campbell Ritchie wrote:Suggest you try copying the Graphics object with its create() method. You might have to cast it to Graphics2D. Then use its scale, rotate, translate and shear methods. The API for AffineTransform tells you which matrix operations they use for the different transforms.
Rob Camick wrote:Don't know if its any better than the API, but the Transforming Shapes, Text, and Images tutorial might help.
Members are either declared in the type, or inherited because they are accessible members of a superclass or superinterface which are neither private nor hidden nor overridden.