This might help:
http://appfuse.org/display/APF/AppFuse+Core+Classes
Matt
On Mon, Apr 21, 2008 at 1:12 AM, Puck <[EMAIL PROTECTED]> wrote:
>
> All the project is structured with hibernate, so i don't want to change it.
>
>
>
>
> Cens wrote:
> >
> > Hi Emilio,
> > I had the same problem, since I had to build an Appfuse application upon
> > an existing database, where the login information are stored in a table
> > that is maintained by a third-party application.
> > Furthermore the database had a lot of composite primary-keys, which are
> > not easily handled with Hibernate.
> > With this requirements I went for iBATIS instead of Hibernate as DAO
> > framework, since this allows me to easily change SQL statements with
> > almost no impact on the source code.
> >
> > So in my case I just modified UserSQL.xml in the sections:
> > <resultMap>
> > <select id="getUser">
> > <select id="getUserByUsername">
> > <select id="getUsers" resultMap="userResult">
> >
> > and removed from
> > <select id="getUserRoles">
> > the join with "user_role".
> >
> > Then I did the following change to UserDaoiBatis.java:
> > public UserDetails loadUserByUsername(String username) throws
> > UsernameNotFoundException {
> > User user = (User)
> > getSqlMapClientTemplate().queryForObject("getUserByUsername", username);
> >
> > if (user == null) {
> > logger.warn("uh oh, user not found...");
> > throw new UsernameNotFoundException("user '" + username + "'
> > not found...");
> > } else {
> > String role;
> > if (user.getUsername().equalsIgnoreCase("admin")) {
> > role = "ROLE_"+user.getUsername().toUpperCase();
> > } else {
> > role = "ROLE_USER";
> > }
> > List roles =
> > getSqlMapClientTemplate().queryForList("getUserRoles", role);
> > user.setRoles(new HashSet<Role>(roles));
> > user.setEnabled(true);
> > }
> >
> > return user;
> > }
> > That implies that there is just one administrator and it has to be exactly
> > "admin".
> >
> > If you intend to stay with Hibernate I suppose you need to make changes in
> > annotations @Column in model User.java in order to map attributes in your
> > specific column names and remove the following relationship:
> >
> > @ManyToMany(fetch = FetchType.EAGER)
> > @JoinTable(
> > name="user_role"
> >
> >
> > Bye
> >
> > Vincenzo Caselli
> > http://www.censnet.it
> > gtalk: [EMAIL PROTECTED]
> >
> >
> >
> >
> > Puck wrote:
> >>
> >> How can i switch from app_user to an other POJO (Person for example) to
> >> retrieve login informations?
> >>
> >> Thanks
> >> Emilio
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Login-table-tp16763584s2369p16804035.html
>
>
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]