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

Plans to support OneToOne, OneToMany, ManyToOne and ManyToMany #314

Closed
cassioseffrin opened this issue Apr 16, 2020 · 6 comments
Closed
Labels
duplicate This issue or pull request already exists

Comments

@cassioseffrin
Copy link
Contributor

Hello,

There is any plan to allow Floor to support OneToOne, OneToMany, ManyToOne and ManyToMany relationships?

Maybe you can take a look at JaguarORM: https://github.com/Jaguar-dart/jaguar_orm

@mqus
Copy link
Collaborator

mqus commented Apr 16, 2020

At least a part of what you possibly want are ForeignKeys in the @Entity annotation.
If you want to see how they work in detail you can also look at the same feature in androids room library. There should be many uses in android apps in the wild which you can look at, I don't have any specific one in mind right now though.

What we should probably consider for implementing is @Relation, but it seems to be pretty complex (but doable).

@mqus
Copy link
Collaborator

mqus commented Apr 16, 2020

Just to be sure though, what is your use case for this, what do you want to do?

@cassioseffrin
Copy link
Contributor Author

Yes it's very complex in fact. There are a lot of dependencies when these kind of mapping are made, including lazy load and eager load and a bunch of configs. The collections needs to have configurations otherwise the queries becoming very heavy to process in database.

The big advantages of these kind of mapping are provide to programmers unlimited capabilities and zero SQL native queries. All the data access will be separated in persistence layer. The code become more concise and easy to maintain.

But I understand your point. If the idea is to keep Floor more simpler may it's not the case. I have made a lot o researches for ORM in dart. Dart don't have a killer ORM library like Java has the Hibernate, SpringData,JPA or even JDBC. Obviously each language has it's own goals and Dart and Java seems to crave for different proposes.

Until now I made my mind to follow with Floor. It's been fulfilling my projects needs. Except these mappings that I will continue to recommend. For my experience these mappings will make Floor the pretty best ORM in dart. And may you can take a look in Jaguar ORM instead of hibernate cause it's simpler, written in dart and follows the same philosophies. I can guarantee (hibernate) is the market standard, and big platforms (like .NET has the same implementations) are using the same nomenclature and concepts.

@mqus mqus added the feature Request and implementation of a feature (release drafter) label May 5, 2020
@mqus
Copy link
Collaborator

mqus commented May 5, 2020

Closing this as a duplicate of #47 which tracks relations

@mqus mqus closed this as completed May 5, 2020
@mqus mqus added duplicate This issue or pull request already exists and removed feature Request and implementation of a feature (release drafter) labels May 5, 2020
@BrianMwas
Copy link

Hello,

There is any plan to allow Floor to support OneToOne, OneToMany, ManyToOne and ManyToMany relationships?

Maybe you can take a look at JaguarORM: https://github.com/Jaguar-dart/jaguar_orm

Hi can we use jaguar ORM with floor with the same db?

@mqus
Copy link
Collaborator

mqus commented Jul 10, 2021

Short answer: no. How would this work anyways? floors streams can only track changes made by floor, and this completely ignores database layout decisions which might be different and defining which part defines/creates the schema and the nightmare of keeping both synchronized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Development

No branches or pull requests

3 participants