我尝试迁移到使用Hibernate 5的Spring Boot 1.4.我有一些包含表创建的MariaDB数据库的备份脚本.
由于Spring Boot中的spring-data-jpa,我的实体正在使用以下id生成策略.
@GeneratedValue(strategy = GenerationType.AUTO)
Run Code Online (Sandbox Code Playgroud)
在我的application.properties我
spring.jpa.generate-ddl=true
spring.jpa.hibernate.use-new-id-generator-mappings=false
Run Code Online (Sandbox Code Playgroud)
Hibernate团队通常不建议使用此设置(false值).
如果我让hibernate生成表,看起来与备份脚本中的那个有些不同.
如果我使用关于生成器的假值并使用备份脚本并在此之后设置为true,我会遇到一些关于oreign键的问题
无法添加或更新子行:外键约束失败...
如果我保持虚假,我会得到相同的结果.
我可以使用什么策略迁移到Hibernate 5的新生成器并拥有旧数据库(不是结构)的数据?
有没有办法保持更通用?不是特定于Hibernate
我使用twitter bootstrap和jquery.
根据变量,我想禁用并删除单击的可能性
<ul class="nav nav-pills nav-stacked">
<li id="member" role="presentation" data-toggle="tab" class="active"><a href="#"><span class="glyphicon glyphicon-inbox"></span> Membres</a></li>
<li id="subscription" role="presentation" data-toggle="tab"><a href="#"><span class="glyphicon glyphicon-bed"></span> Abonnements</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我试过这段代码
if (role != "ROLE_ADMIN") {
$('#subscription').addClass("disabled").find("a").attr("onclick", "return false;");
$('#report').addClass("disabled").find("a").attr("onclick", "return false;");
$('#user').addClass("disabled").find("a").attr("onclick", "return false;");
$('#setup').addClass("disabled").find("a").attr("onclick", "return false;");
} else {
$("#subscription").removeClass("disabled").find("a").removeAttr("onclick");
$("#report").removeClass("disabled").find("a").removeAttr("onclick");
$("#user").removeClass("disabled").find("a").removeAttr("onclick");
$("#setup").removeClass("disabled").find("a").removeAttr("onclick");
}
Run Code Online (Sandbox Code Playgroud)
li已禁用,但我可以点击它...
编辑
$('#user').prop('onclick',null).off('click');
Run Code Online (Sandbox Code Playgroud)
似乎做了这个工作
我使用 spring boot(嵌入 tomcat)和 ssl。
实际上,我需要在 url 中输入端口 (8443) 才能访问 Web 应用程序。
如何才能仅使用域名?
代替
编辑
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat
= new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
securityConstraint.addCollection(collection);
context.addConstraint(securityConstraint);
}
};
tomcat.addAdditionalTomcatConnectors(createHttpConnector());
return tomcat;
}
private Connector createHttpConnector() {
Connector connector
= new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
connector.setSecure(false);
connector.setPort(8080);
connector.setRedirectPort(8443);
return connector;
}
Run Code Online (Sandbox Code Playgroud)
现在不需要输入端口
但如果输入 bob.com,浏览器会转换为
鲍勃.com:8443
我搜索一种方法来改变行上的鼠标光标但不是一个标题(th)
我创建了一个例子
table{
cursor: pointer;
}
Run Code Online (Sandbox Code Playgroud) spring-boot ×2
css ×1
hibernate ×1
html ×1
iptables ×1
javascript ×1
jquery ×1
mariadb ×1
tomcat8 ×1