Browse Source
* commit '55f472d00e09b1ab8581db6e52ca934c0d7414d5': 无jira任务 docs: 补充readme DEC-17895 fix: import fileupload相关类包名错误 DEC-14578 feat: hibernate二级缓存卡顿 DEC-14578 feat: hibernate自动删除旧唯一键 DEC-14578 feat: 使hibernate支持主键的自动更新 DEC-14578 feat: 去掉无用的jetbrain.NotNull依赖, 拆分Utils方法 QFX-1737 fix:数据上传之后报错 DEC-14578 打包脚本 DEC-14578 引入com.alibaba:transmittable-thread-localresearch/11.0
superman
4 years ago
18 changed files with 288 additions and 37 deletions
@ -0,0 +1,2 @@ |
|||||||
|
版本:1.64<br> |
||||||
|
源码:https://www.bouncycastle.org/latest_releases.html<br> |
@ -0,0 +1,23 @@ |
|||||||
|
package com.fr.third.org.hibernate.dialect.unique; |
||||||
|
|
||||||
|
import com.fr.third.org.hibernate.dialect.Dialect; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Andrea Boriero |
||||||
|
*/ |
||||||
|
public class MySQLUniqueDelegate extends DefaultUniqueDelegate { |
||||||
|
|
||||||
|
/** |
||||||
|
* Constructs MySQLUniqueDelegate |
||||||
|
* |
||||||
|
* @param dialect The dialect for which we are handling unique constraints |
||||||
|
*/ |
||||||
|
public MySQLUniqueDelegate(Dialect dialect) { |
||||||
|
super( dialect ); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String getDropUnique() { |
||||||
|
return " drop index "; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,63 @@ |
|||||||
|
package com.fr.third.org.hibernate.tool.schema.internal; |
||||||
|
|
||||||
|
import com.fr.third.org.hibernate.boot.Metadata; |
||||||
|
import com.fr.third.org.hibernate.dialect.Dialect; |
||||||
|
import com.fr.third.org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; |
||||||
|
import com.fr.third.org.hibernate.mapping.Column; |
||||||
|
import com.fr.third.org.hibernate.mapping.PrimaryKey; |
||||||
|
import com.fr.third.org.hibernate.tool.schema.spi.Exporter; |
||||||
|
|
||||||
|
import java.util.Iterator; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Elijah |
||||||
|
* @version 10.5 |
||||||
|
* Created by Elijah on 2020/9/30 |
||||||
|
*/ |
||||||
|
public class StandardPrimaryKeyExporter implements Exporter<PrimaryKey> { |
||||||
|
private Dialect dialect; |
||||||
|
|
||||||
|
public StandardPrimaryKeyExporter(Dialect dialect) { |
||||||
|
this.dialect = dialect; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String[] getSqlCreateStrings(PrimaryKey primaryKey, Metadata metadata) { |
||||||
|
final JdbcEnvironment jdbcEnvironment = metadata.getDatabase().getJdbcEnvironment(); |
||||||
|
final String tableName = jdbcEnvironment.getQualifiedObjectNameFormatter().format( |
||||||
|
primaryKey.getTable().getQualifiedTableName(), |
||||||
|
dialect |
||||||
|
); |
||||||
|
|
||||||
|
final String constraintName = dialect.quote( primaryKey.getName() ); |
||||||
|
return new String[]{ "alter table " + tableName + dialect.getAddPrimaryKeyConstraintString(constraintName) + " " + columnsToString( primaryKey ) }; |
||||||
|
} |
||||||
|
|
||||||
|
protected String columnsToString(PrimaryKey primaryKey) { |
||||||
|
final StringBuilder sb = new StringBuilder(); |
||||||
|
sb.append( " (" ); |
||||||
|
final Iterator<Column> columnIterator = primaryKey.columnIterator(); |
||||||
|
while ( columnIterator.hasNext() ) { |
||||||
|
final Column column = columnIterator.next(); |
||||||
|
sb.append( column.getQuotedName( dialect ) ); |
||||||
|
if ( columnIterator.hasNext() ) { |
||||||
|
sb.append( ", " ); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return sb.append( ')' ).toString(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String[] getSqlDropStrings(PrimaryKey primaryKey, Metadata metadata) { |
||||||
|
final JdbcEnvironment jdbcEnvironment = metadata.getDatabase().getJdbcEnvironment(); |
||||||
|
final String tableName = jdbcEnvironment.getQualifiedObjectNameFormatter().format( |
||||||
|
primaryKey.getTable().getQualifiedTableName(), |
||||||
|
dialect |
||||||
|
); |
||||||
|
final StringBuilder buf = new StringBuilder( "alter table " ); |
||||||
|
buf.append( tableName ); |
||||||
|
buf.append(dialect.getDropPrimaryKeyConstraintString(dialect.quote( primaryKey.getName()))); |
||||||
|
return new String[] { buf.toString() }; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue