package de.hsadmin.mods.db; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import de.hsadmin.core.model.EntityInfo; import de.hsadmin.core.model.SearchFilter; import de.hsadmin.mods.pac.Pac; @Entity(name = "MySqlDatabases") @Table(name = "database") @SequenceGenerator(name = "DatabaseSeqGen", sequenceName = "database_database_id_seq") @EntityInfo(name = "MySQL Datenbank") @SearchFilter("instance = 'mysql' AND (" + " pac = :loginUserPac OR " + " pac.customer.memberCode = :loginUserName )") public class MySqlDatabase extends Database implements Serializable { private static final long serialVersionUID = 2862112440807946042L; public MySqlDatabase() { setInstance("mysql"); setEncoding("UTF-8"); } public MySqlDatabase(Pac pac, String name, String owner, String encoding) { super("mysql", pac, name, owner, encoding); } public String getSystemEncoding() { String sysEnc = getEncoding().toLowerCase().replaceAll("-", ""); return sysEnc; } @Override public Class getSqlUserClass() { return MySqlUser.class; } public static String restriction() { return "instance='mysql' AND ( " + Database.restriction() + " )"; } }