ORMLite Relation one to one?

1,700 views
Skip to first unread message

kong sonida

unread,
May 21, 2013, 5:47:13 AM5/21/13
to ormli...@googlegroups.com
Dear All, 

Could you tell me how to create relation one to one by using ORMLite?

Thanks,

Bazlur Rahman

unread,
Aug 29, 2013, 11:20:16 PM8/29/13
to ormli...@googlegroups.com
you could use following example --

@DatabaseTable
public class User{
    @DatabaseField
    private int id;
    @DatabaseField
    private String userName;
    @DatabaseField
    private String password;
       
    @DatabaseField(foreign = true)   
    private class Role role;


    //getters setters   
}

@DatabaseTable
public class Role{
    @DatabaseField
    private int id;
    @DatabaseField
    private String roleName;
   
    //getters setters   
}

------------
Sincerely
A. N. M. Bazlur Rahman
Software Engineer
Therap Services, LLC
URL: http://www.linkedin.com/in/bazlur

 ---------------------------
Avoid speculative generality
(Write code to solve today's problems, and worry about tomorrow's problems when they actually materialize. Everyone loses in the "what if.." school of design.)


--
You received this message because you are subscribed to the Google Groups "ORMLite Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ormlite-dev...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages