Updated hibernate DDL policy and solved LazyInitializationException bug on User.toString()
This commit is contained in:
parent
ad3e5271ac
commit
0cb1f1606a
4 changed files with 7 additions and 13 deletions
|
@ -29,15 +29,15 @@ public abstract class Device {
|
|||
|
||||
/**
|
||||
* The name for the category of this particular device (e.g 'dimmer'). Not stored in the
|
||||
* database (thanks to 'transient') but set thanks to constructors
|
||||
* database but set thanks to constructors
|
||||
*/
|
||||
private final transient String kind;
|
||||
@Transient private final String kind;
|
||||
|
||||
/**
|
||||
* The way this device behaves in the automation flow. Not stored in the database (thanks to
|
||||
* 'transient') but set thanks to constructors
|
||||
* The way this device behaves in the automation flow. Not stored in the database but set thanks
|
||||
* to constructors
|
||||
*/
|
||||
private final transient FlowType flowType;
|
||||
@Transient private final FlowType flowType;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
|
@ -66,6 +66,5 @@ public abstract class Device {
|
|||
public Device(String kind, FlowType flowType) {
|
||||
this.kind = kind;
|
||||
this.flowType = flowType;
|
||||
this.name = kind + " " + this.id;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@ public class JWTUserDetailsService implements UserDetailsService {
|
|||
@Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
User toReturn = repository.findByUsername(username);
|
||||
System.out.println("malusa: " + username);
|
||||
System.out.println(toReturn);
|
||||
if (toReturn != null) {
|
||||
return new org.springframework.security.core.userdetails.User(
|
||||
toReturn.getUsername(), toReturn.getPassword(), Set.of());
|
||||
|
|
|
@ -86,9 +86,6 @@ public class User {
|
|||
+ '\''
|
||||
+ ", email='"
|
||||
+ email
|
||||
+ '\''
|
||||
+ ", rooms="
|
||||
+ rooms
|
||||
+ '}';
|
||||
+ "\'}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ spring.datasource.password=
|
|||
# Hibernate properties
|
||||
spring.jpa.database=POSTGRESQL
|
||||
spring.jpa.show-sql=true
|
||||
spring.jpa.hibernate.ddl-auto=create-drop
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
|
||||
spring.jpa.properties.hibernate.format_sql=true
|
||||
|
||||
|
|
Loading…
Reference in a new issue