-->
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.  [ 3 posts ] 
Author Message
 Post subject: Cannot override @AccessType("property") with field
PostPosted: Thu May 31, 2007 5:51 am 
Newbie

Joined: Wed May 30, 2007 7:00 pm
Posts: 5
Location: .NL
This was opened before in Hibernate Users, but was misplaced as this is about annotations. I've removed the topic there and opened it here.

Hello,

I'm testing the AccessType annotation and I've found that the following case does not work. Hibernate does not pick up the
@AccessType("field") (from the function in this case), but when placed on the property it also has no effect.

The unit tests for hibernate annotations do not cover this. Am I requesting something impossible?

Code:
@AccessType("propery")
public class Test()
{
   private String test;

    @AccessType("field")
   public WeirdCollection getTest()
   {
      return new WeirdCollection( test );
   }
}


The workaround is as follows (pretty specific for the above case). This is of course very undesirable and leads to an incredible amount of code bloat in more complex situations.

Code:
@AccessType("propery")
public class Test()
{
   private String _test;

   @Transient
   public WeirdCollection getTest()
   {
      return new WeirdCollection( _test );
   }

   public String get_Test(){ return _test; }
   pulbic void set_Test(String test) { this._test = test; }
}


Actually I wanted to use a @CollectionType annotation (which does not exist) to map the WeirdCollection to a List. The accesstype stuff was a hack around it, but it seems that the hack needs a hack...

Hibernate version:
Annotations 3.2.0
Hibernate 3.2.1
(both from Jboss 5 embeddable Beta 2)

Mapping documents:
None, all annotations

Code between sessionFactory.openSession() and session.close():
None, error occurs in loading and configuration

Full stack trace of any exception that occurs:
In this case an exception telling that the WierdCollection is not a Set or List as supported by hibernate


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 31, 2007 1:30 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Can you post a minimal reproducible runnable test case to JIRA? I'll have to have a look.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 31, 2007 2:22 pm 
Newbie

Joined: Wed May 30, 2007 7:00 pm
Posts: 5
Location: .NL
JIRA posted @:
http://opensource.atlassian.com/project ... se/ANN-618


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

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.