Hi Alice. Here's the template for the persistence unit binding annotation
you're looking for. For this discussion example, "JpaUnit" would be
"DbOnePU", so DbOnePU.java. Obviously, remove and/or modify the "default
Defaults.DefaultUnit.class".
/**
* <p>
* A guice binding annotation you should use to tell warp-persist the name
of
* the JPA persistence unit you wish to use. Bind a string with the name to
this
* annotation. For instance, if the name of your persistence unit is "myDb"
you would
* add the following in one of your guice modules:
* </p>
* <code>
* bindConstant().annotatedWith(JpaUnit.class).to("myDb");
* </code>
* If you are using multiple JPA configurations in the same project
(multiple modules),
* bind to an instance of the JpaUnit annotation instead, specifying the
module-level
* binding annotation used to create the persistence module:
* <code>
* bindConstant().annotatedWith(JpaUnitInstance.of(MyDB.class)).to("myDb");
* </code>
* <p>
* You <b>must</b> bind a string to this annotation if using JPA. And it
must match
* a jpa unit named in your JPA persistence.xml.
* </p>
*
* @author Dhanji R. Prasanna ([email protected])
* @since 1.0
*/
@BindingAnnotation
@Retention(RetentionPolicy.RUNTIME)
public @interface JpaUnit {
Class<? extends Annotation> value() default Defaults.DefaultUnit.class;
}
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-guice/-/d3FwRjZHa1FVRWNK.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.