Skip to content

org.springframework.data.mapping.MappingException while trying to use multiple implementations #2761

Open
@Kanish2002

Description

@Kanish2002

Hi I can able to create nodes and rels for multiple implementations..

@Node
class Starter(
    @Id
    val id: Long,
    val name: String,
    @Relationship(type = "RETRIEVES", direction = Relationship.Direction.OUTGOING)
    var dataRetriever: List<DataRetriever>
)

@Node("DataRetriever")
interface DataRetriever


@Node
class WebDataRetriever : DataRetriever{
   @Id
    val id: Long,
    val webDataRetrieverName: String,
    val webDataSource: String,
    val webSource: String,
 @Relationship(type= "Process",direction = Relationship.Direction.OUTGOING)
var dataProcessor: WebDataProcessor
}

@Node("DataProcessor")
interface DataProcessor

@Node
class WebDataProcessor(
    @Id
//some impl
) : DataProcessor

I can able to store that in the neo4j db..

But when trying to retrieve it using Repository..

@Repository
interface StarterRepository : Neo4jRepository<Starter,Long>{
    fun findByName(name: String):Starter
}

I'm getting a exception like
[ restartedMain] .n.c.Neo4jPersistenceExceptionTranslator : Don't know how to translate exception of type class org.springframework.data.mapping.MappingException

Caused by: org.springframework.data.mapping.model.MappingInstantiationException: Failed to instantiate com.zen.neo.NeoTestKotlinNew.model.WebDataRetriever using constructor fun (kotlin.Long, kotlin.String, kotlin.String, kotlin.String, com.zen.neo.NeoTestKotlinNew.model.WebDataProcessor): com.zen.neo.NeoTestKotlinNew.model.WebDataRetriever with arguments 1,webDataRetriever,getWebData,getSrc,null

It's is not mapping to the model correctly! can someone help me to solve this issue!!

SDN version - 6.3.12(from Spring Data Neo4j Starter)
Thanks

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions