Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

[help] How to integrate it with Android Studio #6

Closed
rinav opened this issue Apr 28, 2015 · 11 comments
Closed

[help] How to integrate it with Android Studio #6

rinav opened this issue Apr 28, 2015 · 11 comments

Comments

@rinav
Copy link

rinav commented Apr 28, 2015

I am unable to find any guide to add the library to AndroidStudio.

Is there a jar or aar file that can be directly added?
Also, please let us know how to integrate Jackson and squidb.
I want to use Retrofit for REST and want to bind all three together.

@sbosley
Copy link
Contributor

sbosley commented Apr 28, 2015

At the moment, you will need to clone the squidb repository in order to use it with your projects. This is a temporary solution; we're working on deploying pre-built artifacts so that this step won't be required in the future.

For now though, once squidb is cloned you can add it to your Android Studio workspace by declaring it in your settings.gradle:

include ':squidb'
project(':squidb').projectDir = new File(settingsDir, '../path_to_cloned_root/squidb)
include ':squidb-annotations'
project(':squidb-annotations').projectDir = new File(settingsDir, '../path_to_cloned_root/squidb-annotations)
include ':squidb-processor'
project(':squidb-processor').projectDir = new File(settingsDir, '../path_to_cloned_root/squidb-processor)

Once it's in your settings.gradle file it should show up in studio, and you can then add it as a dependency in your build.gradle using this guide.

As far as Jackson goes--I don't think the squidb-jackson plugin is quite what you want for your use case. It's really just a sample project that demonstrates how you can write plugins for the squidb code generator to serialize non-primitive data types to a single column (see this wiki page] for more details). However, there might be an opportunity to write a new plugin that would facilitate binding with Retrofit. What exactly did you have in mind?

@jdkoren
Copy link
Collaborator

jdkoren commented Apr 28, 2015

I've updated this page with instructions for cloning and adding to settings.gradle. I will probably link directly to it from the readme.

@tomxor
Copy link

tomxor commented Apr 28, 2015

@sbosley re pre-built artifacts, would probably also want to create a fork of apt-utils and deploy it as a separate artifact, instead of the current apt-utils.jar file checked into source control.

@sbosley
Copy link
Contributor

sbosley commented Apr 28, 2015

@tomxor yep we'll do the same for apt-utils, thanks!

@tomxor
Copy link

tomxor commented Apr 28, 2015

👍

@rinav
Copy link
Author

rinav commented Apr 29, 2015

@sbosley Thanks for helping, I am able to setup the Project. I am able to generate a Table and tried to save a record and was successful.

I have another question.
Can we configure our own Primary Key, instead of auto increment?
I am trying to save the user's facebook id info like name, email id etc into the squiDB.
I will be updating this content in case user has logged out or accessToken has expired.

without setting facebook id as primary key I cannot update the record. It keeps on inserting the same record again and again.

this is just one of the usecases.

@jdkoren
Copy link
Collaborator

jdkoren commented Apr 29, 2015

@RiinaV we are considering making this enhancement in the future, but for right now we only support _id as the primary key. You can use the facebook id column and make it unique, and use databaseDao.update() with a criterion instead of using methods like persist():

User user = ...;
// make modifications to user
databaseDao.update(User.FACEBOOK_ID.eq(id), user);

We also support fetching a record by criterion, so you can lookup a User by facebook id, e.g.:

User user = databaseDao.fetch(User.class, User.FACEBOOK_ID.eq(id), User.PROPERTIES);

@kamilwlf
Copy link

When you plan to add gradle maven?

@sbosley
Copy link
Contributor

sbosley commented May 29, 2015

Soon! We'll post back to this issue once we've deployed pre-built artifacts with instructions on how to use squidb without building from source.

@sbosley
Copy link
Contributor

sbosley commented May 29, 2015

Good news everyone! We now have pre-built binaries deployed so you don't have to build from source anymore. Updated instructions for including SquiDB as a dependency can be found at this wiki page.

@sbosley sbosley closed this as completed May 29, 2015
@kamilwlf
Copy link

thanks, excellently

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants