Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeMapper fails into infinite loop for certain Type cycles in user classes #341

Closed
bartoszwalacik opened this issue Feb 20, 2016 · 0 comments
Closed
Labels

Comments

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Feb 20, 2016

repro:

package org.javers.core.cases

import org.javers.core.JaversBuilder
import org.javers.core.metamodel.annotation.Id
import org.javers.repository.jql.QueryBuilder
import spock.lang.Specification

class Employee {
    @Id
    int id
    Person person
}

class Person {
    @Id
    String name
    Employee employee
}

/**
 * @author bartosz.walacik
 */
class OrganizationStructureLoopCase extends Specification{

    def "should manage Employee to Person cycle"(){
        given:
        def person = new Person(name:"kaz")
        def emp = new Employee(id:1, person:person)
        person.employee = emp

        when:
        def javers = JaversBuilder.javers().build()
        javers.commit("a",emp)

        def snapshots = javers.findSnapshots(QueryBuilder.byInstanceId("kaz", Employee).build())

        then:
        snapshots.size() == 1
    }
}
@bartoszwalacik bartoszwalacik added the bug label Feb 20, 2016
bartoszwalacik added a commit that referenced this issue Feb 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant