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.  [ 8 posts ] 
Author Message
 Post subject: Still get error w/ <join> after merging NH-466 into 1.
PostPosted: Thu Nov 08, 2007 12:06 pm 
Regular
Regular

Joined: Thu Nov 30, 2006 10:48 am
Posts: 59
I integrated NH-466 into 1.2GA but still get an error with <join> ('invalid child element'). I included the steps I used for this. Does anyone know the code that I would need to check to see if I have the correct version? Did I perform the steps correctly -- is there any place where I need to include an XSD?

Background: I need to combine table-per-class-hierarchy and table-per-subclass; therefore, I was told that using a <join> in the <subclass> would work (I need to test if both the Get and the Save works properly for this).

DETAILED STEPS FOR INTEGRATING NH-466 to 1.2GA:
1. Create folder, C:\nHibernate
2. Right-click on C:\nHibernate; select 'SVN Checkout' w/ the following settings:
* 'URL of repository': htps://nhibernate.svn.sourceforge.net/s ... nhibernate
* keep 'HEAD revision' selected
3. Right-click C:\nHibernate, select TortoiseSVN - Merge; When Merge window pops up, make sure the following are set:
* URL" https://nhibernate.svn.sourceforge.net/ ... nhibernate
* Revision is selected
4. Separately merge each of the following: 2774, 2836, 2953, 2955
5. Open a command window; cd C:\nHibernate; NAnt set-net-2.0-framework-configuration visual-studio
6. From Visual Studio, open C:\RemoteNHibernate\src\NHibernate\NHibernate-2.0.csproj and build it
7. Copied the following from C:\Projects\nHibernate\src\NHibernate\bin\Debug-2.0

Hibernate version: It's a locally built version of 1.2.0.GA merged with the NH-466 patch; see detailed steps that I used for getting 1.2.0GA, merging the 4 SVN revisions for NH-466, building

Mapping documents:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">

<class name="DomainModel.Device.PhysicalDevice, DomainModel" table="dbo.tblDevice">

<!-- Primary Key -->
<id type="Int32" column="ID" name="ID" unsaved-value="null">
<generator class="identity"></generator>
</id>

<!-- The discriminator tag MUST be just after the <id> tag and before
any <property> tags; otherwise, you'll get an 'invalid child element' XSD validation
error -->
<discriminator column="MyTypeName"/>

<!-- Simple properties -->
<property name="Name" column="DeviceName"/>

<!-- Inheritance: Table per class hierarchy -->
<subclass name="DomainModel.Device.Firewall, DomainModel" discriminator-value="Firewall">
</subclass>
<subclass name="DomainModel.Device.Hub, DomainModel" discriminator-value="Hub">
</subclass>
<subclass name="DomainModel.Device.Router, DomainModel" discriminator-value="Router">
<join table="dbo.tblRouter">
<key column="pDeviceID"/>
<property name="Manufacturer" column="Manufacturer"/>
</join>
</subclass>
</class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

Router r = new Router();
rtr.Name = "Rtr1";
rtr.Manufacturer = "Cisco";
session.Save(rtr);
session.Flush();

Full stack trace of any exception that occurs:

NHibernate.MappingException was unhandled by user code
Message="DAL.nHib.MapFiles.PhysicalDevice.hbm.xml(25,8): XML validation error: The element 'subclass' in namespace 'urn:nhibernate-mapping-2.2' has invalid child element 'join' in namespace 'urn:nhibernate-mapping-2.2'. List of possible elements expected: 'urn:nhibernate-mapping-2.2:meta urn:nhibernate-mapping-2.2:property urn:nhibernate-mapping-2.2:many-to-one urn:nhibernate-mapping-2.2:one-to-one urn:nhibernate-mapping-2.2:component urn:nhibernate-mapping-2.2:dynamic-component urn:nhibernate-mapping-2.2:any urn:nhibernate-mapping-2.2:map urn:nhibernate-mapping-2.2:set urn:nhibernate-mapping-2.2:list urn:nhibernate-mapping-2.2:bag urn:nhibernate-mapping-2.2:idbag urn:nhibernate-mapping-2.2:array urn:nhibernate-mapping-2.2:primitive-array urn:nhibernate-mapping-2.2:subclass urn:nhibernate-mapping-2.2:loader urn:nhibernate-mapping-2.2:sql-insert urn:nhibernate-mapping-2.2:sql-update urn:nhibernate-mapping-2.2:sql-delete'."
Source="NHibernate"
StackTrace:
at NHibernate.Cfg.Configuration.LogAndThrow(MappingException me) in C:\Projects\nHibernate\src\NHibernate\Cfg\Configuration.cs:line 257
at NHibernate.Cfg.Configuration.ValidationHandler(Object o, ValidationEventArgs args) in C:\Projects\nHibernate\src\NHibernate\Cfg\Configuration.cs:line 1658
at System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(ValidationEventHandler eventHandler, Object sender, XmlSchemaValidationException e, XmlSeverityType severity)
at System.Xml.Schema.XmlSchemaValidator.ElementValidationError(XmlQualifiedName name, ValidationState context,
<I cut out the rest>


Name and version of the database you are using: Microsoft SQL Server 2005; Version: 9.00.1406.00; Product Level: RTM; Edition: Developer Edition


Thanks,
Bill

_________________
metazone


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 08, 2007 12:30 pm 
Newbie

Joined: Thu Sep 27, 2007 4:37 pm
Posts: 4
I'm interested in using the <join> element too. Will that be available in a 1.2.1 release any time soon?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 08, 2007 12:39 pm 
Regular
Regular

Joined: Thu Nov 30, 2006 10:48 am
Posts: 59
FYI - Karl Chu kindly sent me a built version of nHibernate w/ patch NH-466 (<join> tag) implemented. Unfortunately, something in my environment was problematic; I instead manually merged the NH-466 patch into the 1.2 GA -- here's the detailed cookbook http://forum.hibernate.org/viewtopic.ph ... highlight=

But, of course, something is not working :(. I checked NHibernate.nhibernate-mapping.xsd and the "subclass" element doesn't have the "join" in it. I also need to know where the .xsd file should be located.

_________________
metazone


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 08, 2007 1:00 pm 
Newbie

Joined: Thu Sep 27, 2007 4:37 pm
Posts: 4
Any chance I can get ahold of that build from Karl and give it a spin?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 08, 2007 2:03 pm 
Regular
Regular

Joined: Thu Nov 30, 2006 10:48 am
Posts: 59
I created a separate email account for this; email me and I can send it to you.

_________________
metazone


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 08, 2007 2:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
Hi Bill, it is possible that you have not merged the patch correctly. Make sure you are merging the differences from the *trunk*. To check, open up the nhibernate-mapping.xsd file from your source and search for the following line:
Code:
<xs:element name="subclass">
You should find it on line 501. Within it, you should see this:
Code:
<xs:element ref="join" minOccurs="0" maxOccurs="unbounded" />
If not, you may not have merged correctly.

_________________
Karl Chu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 08, 2007 2:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
metazone wrote:
I created a separate email account for this; email me and I can send it to you.


Hi Bill, I realized what I sent you the first time was a combined patch/diff file of the source, not the compiled DLL. If you want the compiled DLL, please send me another email.

khubla, you can also send me an email if you would like the pre-compiled DLL.

NOTE: We just confirmed a bug in the <join> patch. See NH-1059 on JIRA.

_________________
Karl Chu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 08, 2007 2:59 pm 
Regular
Regular

Joined: Thu Nov 30, 2006 10:48 am
Posts: 59
I must not have done the merge properly. I used TortoiseSVN for the Subversion client; there seems to be a potential for misuse in its merge user interface (http://www.svnforum.org/2017/viewtopic. ... 434f037da0). I annotated the cookbook steps to include the warning that the merge info may be incorrect.

_________________
metazone


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.