Skip to content

Instantly share code, notes, and snippets.

@ankitdubey021
Last active July 16, 2019 12:31
Show Gist options
  • Save ankitdubey021/cbe133968a48be9b8c09188e97f057c6 to your computer and use it in GitHub Desktop.
Save ankitdubey021/cbe133968a48be9b8c09188e97f057c6 to your computer and use it in GitHub Desktop.
package dao;
import java.util.List;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
@Dao
public interface StudentDAO{
@Query("SELECT * FROM student_master ORDER BY name")
List<Student> getAllStudents();
@Insert
void insertStudent(Student student);
@Update(onConflict = OnConflictStrategy.REPLACE)
void updateStudent(Student student);
@Delete
void deleteStudent(Student st);
@Query("SELECT * FROM student_master WHERE sno= :id")
Student getStudentById(int id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment