[ http://jira.jboss.com/jira/browse/EJBTHREE-134?page=history ]

Dan Pupaza updated EJBTHREE-134:
--------------------------------

    Summary: ManyToOne annotation - fetch attribute ignored  (was: ManyToOne 
annotation ? fetch attribute ignored)

> ManyToOne annotation - fetch attribute ignored
> ----------------------------------------------
>
>          Key: EJBTHREE-134
>          URL: http://jira.jboss.com/jira/browse/EJBTHREE-134
>      Project: EJB 3.0
>         Type: Bug
>   Components: EJB3 Extensions
>     Versions: Preview 5, Preview 4
>  Environment: JBoss sp1, linux, JDK 5.0 Sun
>     Reporter: Dan Pupaza

>
>
> I have the following entity bean:
> @javax.persistence.Entity
> @javax.persistence.Table(name = "USER")
> public class User implements Serializable {
>    ...
>    private Customer customer;
>    @javax.persistence.ManyToOne(fetch = javax.persistence.FetchType.LAZY)
>    @javax.persistence.JoinColumn(name = "customerId")
>    public Customer getCustomer() {
>       return customer;
>    }
>     ...
> }
> The fetch attribute is ignored and when the User object is returned the 
> customer field is automatically populated (the default option is 
> FetchType.EAGER).
> Running the entity2xml target I get the following section corresponding to 
> the method defined above:
> <many-to-one name="customer"
>         access="property"
>         entity-name="com.business.persistence.Customer"
>         cascade="none">
>         <column name="customerId" not-null="false"/> 
> </many-to-one>
> Conform to the definition (Persistence-edr2.pdf, at page 98):
> @Target({METHOD, FIELD}) @Retention(RUNTIME)
>   public @interface ManyToOne {
>   String targetEntity() default "";
>   CascadeType[] cascade() default {};
>   FetchType fetch() default EAGER;
>   boolean optional() default true;
> }
> ManyToOne accepts the fetch attribute and it could have the FetchType.EAGER 
> (default) or FetchType.LAZY value.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.jboss.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to