Add schema changes for compatibility with JDO implementation

This commit is contained in:
Martin Stockhammer 2016-11-19 23:26:08 +01:00
parent 7482c06fcd
commit e55262c8cc
7 changed files with 21 additions and 16 deletions

View File

@ -34,6 +34,7 @@
<property name="openjpa.jdbc.MappingDefaults"
value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/>
<property name="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE"/>
<property name="openjpa.jdbc.DBDictionary" value="(disableSchemaFactoryColumnTypeErrors=true,BitTypeName=CHAR(1),BooleanTypeName=CHAR(1),BooleanRepresentation=STRING_YN)"/>
</properties>
</persistence-unit>
</persistence>

View File

@ -40,7 +40,7 @@ public class JpaOperation implements Operation, Serializable {
@Column(name="DESCRIPTION")
private String description;
@Column(name="PERMANENT", nullable = false)
private boolean permanent;
private Boolean permanent = false;
@Override

View File

@ -40,7 +40,7 @@ public class JpaPermission implements Permission,Serializable {
@Column(name="DESCRIPTION")
private String description;
@Column(name="PERMANENT", nullable = false)
private boolean permanent;
private Boolean permanent = false;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(
name="OPERATION_NAME_OID",

View File

@ -37,10 +37,10 @@ public class JpaResource implements Resource, Serializable {
@Id
@Column(name="IDENTIFIER")
private String identifier;
@Column(name="PATTERN", nullable = false)
private boolean pattern;
@Column(name="PERMANENT", nullable = false)
private boolean permanent;
@Column(name="PATTERN", nullable = false, columnDefinition = "CHAR(1)")
private Boolean pattern = false;
@Column(name="PERMANENT", nullable = false, columnDefinition = "CHAR(1)")
private Boolean permanent = false;
@Override

View File

@ -43,9 +43,9 @@ public class JpaRole extends AbstractRole implements Serializable {
@Column(name="DESCRIPTION")
private String description;
@Column(name="ASSIGNABLE",nullable = false)
private boolean assignable;
private Boolean assignable = false;
@Column(name="PERMANENT", nullable = false)
private boolean permanent;
private Boolean permanent = false;
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@OrderColumn(name="INTEGER_IDX", nullable = false)
@JoinTable(

View File

@ -58,7 +58,7 @@ public class JpaUserAssignment extends AbstractUserAssignment implements UserAss
)
private List<String> roleNames = new ArrayList<String>();
@Column(name="PERMANENT", nullable = false)
private boolean permanent = false;
private Boolean permanent = false;
@Column(name="LAST_UPDATED")
private Date timestamp;

View File

@ -19,6 +19,9 @@ package org.apache.archiva.redback.users.jpa.model;
* under the License.
*/
import org.apache.openjpa.persistence.ExternalValues;
import org.apache.openjpa.persistence.Type;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
@ -26,6 +29,7 @@ import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import java.util.ArrayList;
@ -52,26 +56,26 @@ public class JpaUser implements org.apache.archiva.redback.users.User {
private Date lastPasswordChange;
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn(name="INTEGER_IDX", nullable = false)
@Column(name="STRING_ELE")
@Column(name="STRING_ELE", nullable = false)
@CollectionTable(name="JDOUSER_PREVIOUSENCODEDPASSWORDS",
joinColumns = @JoinColumn(name = "USERNAME_OID", nullable = false, referencedColumnName = "USERNAME")
)
private List<String> previousEncodedPasswords = new ArrayList<String>();
@Column(name="PERMANENT", nullable = false)
private boolean permanent;
private Boolean permanent = false;
@Column(name="LOCKED", nullable = false)
private boolean locked;
private Boolean locked = false;
@Column(name="PASSWORD_CHANGE_REQUIRED", nullable = false)
private boolean passwordChangeRequired;
private Boolean passwordChangeRequired = false;
@Column(name="VALIDATED", nullable = false)
private boolean validated;
private Boolean validated = false;
@Column(name="COUNT_FAILED_LOGIN_ATTEMPTS",nullable = false)
private int countFailedLoginAttempts;
private int countFailedLoginAttempts = 0;
@Column(name="ACCOUNT_CREATION_DATE")
private Date accountCreationDate;
@Column(name="LAST_LOGIN_DATE")
private Date lastLoginDate;
@Column(name="USER_PASSSWORD")
@Column(name="USER_PASSWORD")
private String rawPassword;