-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: @CollectionOfElements doesn't load eager
PostPosted: Sun Jan 13, 2008 10:31 pm 
Newbie

Joined: Mon Aug 28, 2006 6:31 am
Posts: 16
Hello,

i'm using following mapping:

Code:
@CollectionOfElements(fetch=FetchType.EAGER)   
   @JoinTable(name = "SCHEMA_ENTRY", joinColumns = @JoinColumn(name = "SCHEMA_FK", nullable = false))
   @MapKeyManyToMany(joinColumns = @JoinColumn(name = "ENTRY_FK", nullable = false), targetEntity = NotificationSchemaEntry.class)
   @Column(name = "ALLOWED")
   @Target(NotificationSchema.class)
   @Cascade({ALL,DELETE_ORPHAN})
   @Fetch(FetchMode.JOIN)   
   private Map<NotificationSchemaEntry, Boolean> entries;



the resulted mapping is correct and the application works fine, but if i need to load the schema by traversing the corresponding attribute tree of entity "user" (user.getNotificationSchema()) the entries will not be loaded eager but as 1+n select. Also FetchMode.SUBSELECT didn't work.

Also @Cascade option doesn't persist the entries as expected. Do i need any backreference on entry? The resulted relation seems to be ok:

Code:
CREATE TABLE schema_entry
(
  schema_fk bigint NOT NULL,
  allowed boolean,
  entry_fk bigint NOT NULL,
  CONSTRAINT schema_entry_pkey PRIMARY KEY (schema_fk, entry_fk),
  CONSTRAINT fk74ca203436c32af0 FOREIGN KEY (entry_fk)
      REFERENCES notification_schema_entry (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fk74ca2034ff60e990 FOREIGN KEY (schema_fk)
      REFERENCES notification_schema (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)


I would be grateful for any hint.

Thanks, Gena.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.