-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: download example application and need help
PostPosted: Thu Jun 09, 2016 5:16 am 
Newbie

Joined: Thu Jun 09, 2016 5:12 am
Posts: 2
Hi I am new with spring and hibernate
I download an application form internet and need to run it https://github.com/philipsorst/angular- ... ngsecurity

I had the following Entities
Code:
package net.dontdrinkandroot.example.angularrestspringsecurity.entity;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;


@javax.persistence.Entity
public class User implements Entity, UserDetails
{

   @Id
   @GeneratedValue
   private Long id;

   @Column(unique = true, length = 16, nullable = false)
   private String name;

   @Column(length = 80, nullable = false)
   private String password;

   @ElementCollection(fetch = FetchType.EAGER)
   private Set<Role> roles = new HashSet<Role>();


   protected User()
   {
      /* Reflection instantiation */
   }

   public User(String name, String passwordHash)
   {
      this.name = name;
      this.password = passwordHash;
   }

   public Long getId()
   {
      return this.id;
   }

   public void setId(Long id)
   {
      this.id = id;
   }

   public String getName()
   {
      return this.name;
   }

   public void setName(String name)
   {
      this.name = name;
   }

   public Set<Role> getRoles()
   {
      return this.roles;
   }

   public void setRoles(Set<Role> roles)
   {
      this.roles = roles;
   }

   public void addRole(Role role)
   {
      this.roles.add(role);
   }

   @Override
   public String getPassword()
   {
      return this.password;
   }

   public void setPassword(String password)
   {
      this.password = password;
   }

   @Override
   public Collection<? extends GrantedAuthority> getAuthorities()
   {
      return this.getRoles();
   }

   @Override
   public String getUsername()
   {
      return this.name;
   }

   @Override
   public boolean isAccountNonExpired()
   {
      return true;
   }

   @Override
   public boolean isAccountNonLocked()
   {
      return true;
   }

   @Override
   public boolean isCredentialsNonExpired()
   {
      return true;
   }

   @Override
   public boolean isEnabled()
   {
      return true;
   }
}


Code:
package net.dontdrinkandroot.example.angularrestspringsecurity.entity;

import org.springframework.security.core.GrantedAuthority;


public enum Role implements GrantedAuthority
{
   USER("ROLE_USER"),
   ADMIN("ROLE_ADMIN");

   private String authority;


   Role(String authority)
   {
      this.authority = authority;
   }

   @Override
   public String getAuthority()
   {
      return this.authority;
   }
}


but I don't know how to create the tables

if any body can help me with this please


Top
 Profile  
 
 Post subject: Re: download example application and need help
PostPosted: Thu Jun 09, 2016 6:04 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
It's all here. After you read the User Guide, you'll know how to do it for sure.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.