florent37 / freezer Goto Github PK
View Code? Open in Web Editor NEWA simple & fluent Android ORM, how can it be easier ? RxJava2 compatible
License: Apache License 2.0
A simple & fluent Android ORM, how can it be easier ? RxJava2 compatible
License: Apache License 2.0
I know this sounds like a stupid question. I am fairly new to this architecture. I couldn't find UserEntityManager
and CatEntityManager
classes in the demo, that seems to be in
com.github.florent37.orm.model.CatEntityManager
and
com.github.florent37.orm.model.UserEntityManager
, but are not. How to resolve this?
There is no class named Freezer in any of packages.
Added and compiled the dependencies successfully but i am unable to access the classes in my application,
Example: I cannot access Freezer.onCreate(this);
Warning:Supported source version 'RELEASE_7' from annotation processor 'fr.xebia.android.freezer.Processor' less than -source '1.8'
my project is code in kotlin,but it dosen't workγ
field visit private
is it possible to have different db and create new one every day? I save a lot of data in one day and db operation become very slow.
Cause exception: "android.database.StaleDataException: Attempting to access a closed CursorWindow.Most probable cause: cursor is deactivated prior to calling this method."
I added a new Model class 'ATM' and when I start the app I get:
SQLiteException: no such table: ATM (code 1): , while compiling: INSERT OR REPLACE INTO ATM(att1,att2,att3,att4,att5) VALUES (?,?,?,?,?)
Do I actually need to run a Migration to add a table?
(That's what I plan to do as a workaround)
Sup! Please, add this method and example how to call it
How can i run
select distinct MESSAGEMODEL.fromUser from MESSAGEMODEL
i am using
messageModelEntityManager.select().fields(MessageModelColumns.fromUser).asList()
that gives the query
select distinct MESSAGEMODEL._id, MESSAGEMODEL.fromUser from MESSAGEMODEL
how can i make query that distinct single column
migration not fire i wrote the code but it did not work ?
@DatabaseName("database")
public class DatabaseMigration {
@Migration(1)
public static void migrateTo1(Migrator migrator) {
migrator.update("TIME")
.addField("isBusy", ColumnType.Primitive.Boolean);
}
}
and it say's the class never used
I followed readme file, but i get this error
Error:(31, 35) error: cannot assign a value to final variable CREATOR
Error:(31, 46) error: incompatible types: List<Article> cannot be converted to Creator<Article>
Error:(73, 24) error: no suitable method found for insertForArticle(SQLiteDatabase,Creator<Article>,long,String)
method ArticleCursorHelper.insertForArticle(SQLiteDatabase,Article,long,String) is not applicable
(argument mismatch; Creator<Article> cannot be converted to Article)
method ArticleCursorHelper.insertForArticle(SQLiteDatabase,List<Article>,long,String) is not applicable
(argument mismatch; Creator<Article> cannot be converted to List<Article>)
Error:(88, 24) error: no suitable method found for updateForArticle(SQLiteDatabase,Creator<Article>,Long,String)
method ArticleCursorHelper.updateForArticle(SQLiteDatabase,Article,long,String) is not applicable
(argument mismatch; Creator<Article> cannot be converted to Article)
method ArticleCursorHelper.updateForArticle(SQLiteDatabase,List<Article>,long,String) is not applicable
(argument mismatch; Creator<Article> cannot be converted to List<Article>)
here Article class
`@Model
public class Article implements Parcelable {
String title;
String imageUrl;
Date date;
String content;
String description;
String author;
List<String> tags;
String comments;
String formattedDate;
public String getTitle() {
return title;
}
public Article setTitle(String title) {
this.title = title;
return this;
}
public Article setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
return this;
}
public Date getDate() {
return date;
}
public Article setDate(long date) {
this.date = new Date(date);
this.formattedDate = DateUtils.getRelativeTimeSpanString(date).toString();
return this;
}
public String getContent() {
return content;
}
public Article setContent(String content) {
this.content = content;
return this;
}
public String getAuthor() {
return author;
}
public Article setAuthor(String author) {
this.author = author;
return this;
}
public String getDescription() {
return description;
}
public Article setDescription(String description) {
this.description = description;
return this;
}
public List<String> getTags() {
return tags;
}
public Article setTags(List<String> tags) {
this.tags = tags;
return this;
}
public String getComments() {
return comments;
}
public Article setComments(String comments) {
this.comments = comments;
return this;
}
public String getFormattedDate() {
return formattedDate;
}
public String getImageUrl() {
return imageUrl;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.title);
dest.writeString(this.imageUrl);
dest.writeLong(date != null ? date.getTime() : -1);
dest.writeString(this.content);
dest.writeString(this.description);
dest.writeString(this.author);
dest.writeStringList(this.tags);
dest.writeString(this.comments);
dest.writeString(this.formattedDate);
}
public Article() {
}
protected Article(Parcel in) {
this.title = in.readString();
this.imageUrl = in.readString();
long tmpDate = in.readLong();
this.date = tmpDate == -1 ? null : new Date(tmpDate);
this.content = in.readString();
this.description = in.readString();
this.author = in.readString();
this.tags = in.createStringArrayList();
this.comments = in.readString();
this.formattedDate = in.readString();
}
public static final Parcelable.Creator<Article> CREATOR = new Parcelable.Creator<Article>() {
public Article createFromParcel(Parcel source) {
return new Article(source);
}
public Article[] newArray(int size) {
return new Article[size];
}
};
}
`
and i cannot find Freezer class also after build
Hi @florent37
Your lib is really cool and easy to use, I like it and thanks to you.
Can you please tell me, is this possible to have one model, that uses in two different screens for different purposes?
Hello Florent,
Just to inform you that's theres is a mistake in your Readme.MD regarding package name.
The following will work (note the fr.xebia instead the com.xebia)
dependencies {
apt 'fr.xebia.android.freezer:freezer-compiler:1.0.0'
provided 'fr.xebia.android.freezer:freezer-annotations:1.0.0'
}
Have a good day !
Hi !
As the title of the issue say, i created a Model :
@Model
public class FavoriteSpot {
String name;
double latitude;
double longitude;
long timestamp;
int used;
public FavoriteSpot(){
}
public FavoriteSpot(String name, LatLng latLng, long timestamp){
this.name = name;
latitude = latLng.latitude;
longitude = latLng.longitude;
this.timestamp = timestamp;
used = 0;
}
@Override
public String toString() {
return "FavoriteSpot{" +
"name='" + name + '\'' +
", latitude=" + latitude +
", longitude=" + longitude +
", timestamp=" + timestamp +
", used=" + used +
'}';
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getLatitude() {
return latitude;
}
public double getLongitude() {
return longitude;
}
public long getTimestamp() {
return timestamp;
}
public int getUsed() {
return used;
}
}
When i tried to get my Model through it's entity manager, i can not access to it's double variables (latitude and longitude), for example :
favoriteSpotEntityManager.select().latitude()
-> Did not work π
but :
favoriteSpotEntityManager.select().name()
-> Is working fine π
It's probably me who didn't use correctly the library, because your change log explicitly say that you handle double value. So if you can point my error i would be glad.
How can use it with an existing database in assets?
After updating to gradle:3.0.0-alpha1, the EntityManagers are not being built and are missing for the next steps in the build-process.
Hi! I've this classes
public class Condiment {
long priority;
CondimentCategory category;
String name;
float priceToAdd;
float priceToRemove;
}
and class CondimentCategory.
if I save a condiment it's ok. Than I update condiment object and change CondimentCategory, but after update condimentCategory not changed.
How can I update all?
Is i able to set default value like createdDate = current time
java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase
Is there any feature like create if the data not exists or update
how i can support dagger to add @Inject in the UserEntitiyManger usermanger;
UserEntityManager class not founded in example i want to check it please
I've just init a empty project and adding dependency to your library lead to :
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
java.lang.UnsupportedClassVersionError: fr/xebia/android/freezer/annotations/Model : Unsupported major.minor version 52.0
I also accounted the same issue #17 when access database in multithread . Now I use synchronized for all db manipulations(both read and write) , so that only one thread to access db to prevent these issue. Any other good suggestion Or you can add multi thread access support in next release?
Not working as said #24, it again creates new column
now I need to use a loop to get the records for multiple ids. Can I use something like "in" of sql to query once and get all the records
"select * from table where id in (10,20,30)"
Which may cause "java.lang.IllegalStateException: attempt to re-open an already-closed object." or "java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed."
i've this DB
############
Condiments
id
name
priceToRemove
priceToAdd
############
############
Category
id
name
############
############
Products
id
name
price
condiments (list)
category (object)
############
so I create a category > Pizza
than create another category > Panzerotti
than create condiment > mozzarella
than another condiment > pomodoro
than create product > Margherita with category "pizza" and condiments "mozzarella, pomodoro"
than create another product > Panzerotto fritto with category "panzerotto" and condiments "pomodoro"
I get this error
attempt to re-open an already-closed object: SQLiteDatabase: /data/data/it.croccio.gesty/databases/database.db
Duplicate entries of relations are created, when the parent entity is being updated.
Scenario: The app fetches data from an API & stores it in a table, this is the model:
Tour {
List(Place) places;
β¦
}
Step 1: App fetches data, like fetchAllTours()
Step 2: A tour is added on API side, i.e. all existing tours stay the same --> fetchAllTours()
All the existing tours get updated in the DB now, but each time a new row in the pivot table ("TOUR_PLACE") is being created. Resulting in duplicates: Getting one of the already existing Tours from the DB will now have each place twice.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.