Coder Social home page Coder Social logo

Comments (7)

NikitaEgorov avatar NikitaEgorov commented on June 21, 2024

I explain what happened
nhibernate/nhibernate-core#2913

from nhibernate-envers.

RogerKratz avatar RogerKratz commented on June 21, 2024

Can you write a failing test? Or at least show some minimal mapping to recreate the issue?

from nhibernate-envers.

NikitaEgorov avatar NikitaEgorov commented on June 21, 2024

I use test from NHibernate.Envers.Tests.Integration.EntityNames.SingleAssociatedAudited.ReadEntityAssociatedAuditedTest

Change mapping (add lazy everywhere)

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
									 assembly="NHibernate.Envers.Tests"
									 namespace="NHibernate.Envers.Tests.Integration.EntityNames.SingleAssociatedAudited">
	<class name="Person" entity-name="Personaje" table ="OWNERS">
		<id name="Id" column="ID_PERSON" type="long" >
			<generator class="native" />
		</id>
		<property name="Name" type="string" length="255"
			column="NAME" not-null="true" lazy="true" />
		<property name="Age" type="int" lazy="true" column="AGE"/>
	</class>

	<!-- Deliberately use the same domain object and map it to a different database table. See issue HHH-4648. -->
	<class name="Person" entity-name="Driveraje" table ="DRIVERS">
		<id name="Id" column="ID_PERSON" type="long" >
			<generator class="native" />
		</id>
		<property name="Name" type="string" length="255"
			column="NAME" not-null="true" lazy="true" />
		<property name="Age" type="int" column="AGE" lazy="true"/>
	</class>


	<class name="Car" >
		<id name="Id" column="ID_CAR" type="long">
			<generator class="native" />
		</id>
		<property name="Number" type="int" not-null="true" column="numb" lazy="true"/>
		<many-to-one name="Owner" entity-name="Personaje"/>
		<many-to-one name="Driver" entity-name="Driveraje"/>
	</class>
</hibernate-mapping>

And change Test initialize (add reference to exists item)

protected override void Initialize()
{
        var pers1 = new Person { Name = "Hernan", Age = 15 };
        var pers2 = new Person { Name = "Leandro", Age = 19 };

	var car1 = new Car {Number = 1, Owner = pers1};
	var car2 = new Car {Number = 2, Owner = pers2};

	//rev 1
	using (var tx = Session.BeginTransaction())
	{
		id_pers1 = (long) Session.Save("Personaje", pers1);
		id_car1 = (long) Session.Save(car1);
		tx.Commit();
	}

	//rev 2
	using (var tx = Session.BeginTransaction())
	{
		pers1.Age = 50;
		id_pers2 = (long) Session.Save("Personaje", pers2);
		id_car2 = (long) Session.Save(car2);
		tx.Commit();
	}

	Session.Clear();

	// THIS IS THE BUG LOGIC
	using (var tx = Session.BeginTransaction())
	{
		var pp = Session.Query<Person>().Where(x => x.Id == id_pers1).SingleOrDefault();

		var car3 = new Car { Number = 3, Owner = pp };
		Session.Save(car3);
		tx.Commit();
	}
}

No persister for: PersonProxyForFieldInterceptor

from nhibernate-envers.

RogerKratz avatar RogerKratz commented on June 21, 2024

Most probably same issue as https://hibernate.atlassian.net/browse/HHH-13760.

Can you please create a PR where you've simplify above example as much as possible and created a new failing test for it?

from nhibernate-envers.

NikitaEgorov avatar NikitaEgorov commented on June 21, 2024

@RogerKratz
Pull request with test for bug reproducing
#38

from nhibernate-envers.

bahusoid avatar bahusoid commented on June 21, 2024

See possible fix nhibernate/nhibernate-core#2913 (comment)

from nhibernate-envers.

RogerKratz avatar RogerKratz commented on June 21, 2024

fixed

from nhibernate-envers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.