-->
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: Duplicate import using mapping attributes
PostPosted: Wed Jun 06, 2007 3:37 pm 
Newbie

Joined: Wed Jun 06, 2007 3:25 pm
Posts: 1
Hi

I'm using the mapping attributes instead of the xml files, and I'm having a problem determining how to add the right attributes for two classes which share the same name, but in different namespaces in the same assembly.

For example:

Code:
namespace MyCompany.Domain.Area1
{
    [HibernateMapping(AutoImport = false, Namespace = "MyCompany.Domain.Area1", Assembly = "MyCompany.Domain")]
    [Class(1, Table = "DomainArea1", Name = "MyCompany.Domain.Area1.Widget, MyCompany.Domain")]
    public class Widget
    {
    }
}

namespace MyCompany.Domain.Area2
{
    [HibernateMapping(AutoImport = false, Namespace = "MyCompany.Domain.Area2", Assembly = "MyCompany.Domain")]
    [Class(1, Table = "DomainArea2", Name = "MyCompany.Domain.Area2.Widget, MyCompany.Domain")]
    public class Widget
    {
    }
}


And I'm referencing these in collections as follows:

Code:
namespace MyCompany.Domain
{
    public class WidgetHolder
    {
        [Set(Lazy = true)]
        [Key(1)]
        [OneToMany(2, Class = "MyCompany.Domain.Area1.Widget, MyCompany.Domain")]
        public ISet<Widget> Widgets
        {
        }
     }
}


namespace MyCompany.Domain
{
    public class DifferentWidgetHolder
    {
        [Set(Lazy = true)]
        [Key(1)]
        [OneToMany(2, Class = "MyCompany.Domain.Area2.Widget, MyCompany.Domain")]
        public ISet<Widget> Widgets
        {
        }
     }
}


But I get the "duplicate import" exception referring to my widgets, and suggesting I add auto-import = false to my mappings. As you can see, I've already got autoimport specified.

I've read the other thread on this issue and the auto-import attribute seemed to work for that person, so where am I going wrong?

Cheers
Lee


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.