Skip to content

Commit

Permalink
add custom dao class
Browse files Browse the repository at this point in the history
  • Loading branch information
pblachut committed Apr 26, 2016
1 parent 72d1cfe commit 67cc2d8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.List;

import piotrek.atmlocator.orm.Atm;
import piotrek.atmlocator.orm.AtmDao;
import piotrek.atmlocator.orm.Bank;
import piotrek.atmlocator.orm.BankDao;
import piotrek.atmlocator.orm.DbHelper;
Expand All @@ -27,7 +28,7 @@ public class MapsActivity extends AppCompatActivity implements OnMapReadyCallbac

private final int REQUEST_CODE = 5;
private GoogleMap mMap;
private Dao<Atm, Integer> atmDao;
private AtmDao atmDao;
private BankDao bankDao;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Created by Admin on 2016-04-26.
*/

@DatabaseTable(tableName = "atm")
@DatabaseTable(tableName = "atm", daoClass = AtmDao.class)
public class Atm {
@DatabaseField(generatedId = true, columnName = Columns.ID)
private int id;
Expand Down
24 changes: 24 additions & 0 deletions AtmLocator/app/src/main/java/piotrek/atmlocator/orm/AtmDao.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package piotrek.atmlocator.orm;

import com.j256.ormlite.dao.BaseDaoImpl;
import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.table.DatabaseTableConfig;

import java.sql.SQLException;

/**
* Created by Admin on 2016-04-26.
*/
public class AtmDao extends BaseDaoImpl<Atm, Integer> {
protected AtmDao(Class<Atm> dataClass) throws SQLException {
super(dataClass);
}

protected AtmDao(ConnectionSource connectionSource, Class<Atm> dataClass) throws SQLException {
super(connectionSource, dataClass);
}

protected AtmDao(ConnectionSource connectionSource, DatabaseTableConfig<Atm> tableConfig) throws SQLException {
super(connectionSource, tableConfig);
}
}

0 comments on commit 67cc2d8

Please sign in to comment.