Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @DatabaseTable(tableName = "Threads")
- public class Thread {
- @DatabaseField(id = true)
- private String subject;
- @DatabaseField(foreign = true, foreignAutoRefresh = true)
- public User user = new User();
- public void setSubject(String subject) {
- this.subject = subject;
- }
- public String getSubject() {
- return subject;
- }
- }
- @DatabaseTable(tableName = "Users")
- public class User {
- @DatabaseField(id = true)
- private String nickName;
- @DatabaseField
- private String password;
- @DatabaseField
- private String email;
- @ForeignCollectionField(eager = false)
- public Collection<Thread> threads = new ArrayList<Thread>();
- public void setNickName(String nickName) {
- this.nickName = nickName;
- }
- public String getNickName() {
- return nickName;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public String getPassword() {
- return password;
- }
- public void setEmail(String email) {
- this.email = email;
- }
- public String getEmail() {
- return email;
- }
- }
- Exception in thread "main" java.lang.IllegalArgumentException: No fields have a DatabaseField annotation in class java.lang.Thread
- JdbcConnectionSource connectionSource = new JdbcConnectionSource(
- databaseUrl);
- Dao<Board, String> boardDAO = DaoManager.createDao(
- connectionSource, Board.class);
- Dao<Category, String> categoryDAO = DaoManager.createDao(
- connectionSource, Category.class);
- Dao<Thread, String> threadDAO = DaoManager.createDao(
- connectionSource, Thread.class);
- Dao<User, String> userDAO = DaoManager.createDao(
- connectionSource, User.class);
- TableUtils.createTable(connectionSource, Board.class);
- TableUtils.createTable(connectionSource, Category.class);
- TableUtils.createTable(connectionSource, Thread.class);
- TableUtils.createTable(connectionSource, User.class);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement