GreenDao library(SQL) Self table Many-To-Many

I'm trying to build self many to many relation for USER table to itself - USER table. The idea is that each user might have some friends users and vice versa.

I'm doing it with a junction function but then when I'm trying to compile it I'm getting the exception:

Exception in thread "main" java.lang.RuntimeException: Duplicate name for ToOne 'User' from UsersJoinFollowedUsers to User

at de.greenrobot.daogenerator.Entity.init3rdPassRelations(Entity.java:559)

at de.greenrobot.daogenerator.Entity.init3ndPass(Entity.java:550)

at de.greenrobot.daogenerator.Schema.init3ndPass(Schema.java:185)

at de.greenrobot.daogenerator.DaoGenerator.generateAll(DaoGenerator.java:94)

at de.greenrobot.daogenerator.DaoGenerator.generateAll(DaoGenerator.java:79)

at de.greenrobot.daogenerator.gentest.CodeGenerator.main(CodeGenerator.java:84)

It happens because the junction function points twice to the same entity - USER:

USER TABLE | JUNCTION_TABLE | USER TABLE

left relation: USER -> JUNCTION -> USER

right relation: USER<- JUNCTION <- USER

So I'm guessing that the question is how to create this kind of self Many-To-Many in GreenDao.

Answers


The message "Duplicate name for ToOne 'User' from UsersJoinFollowedUsers to User" indicates that this will help you: Multiple toMany relationships to a single table


Need Your Help

How do I run a program as nobody?

c linux security ubuntu

I want a user-privileged (not root) process to launch new processes as user nobody. I've tried a straight call to setuid that fails with -1 EPERM on Ubuntu 8.04:

OOP Should all properties have getters and setters

oop design-patterns

I have always provided getters and setters for most class properties.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.