问1)我们如何使用Hibernate建模三元关系?例如,我们如何使用Hibernate(或JPA)对这里呈现的三元关系进行建模?
注意:我知道JPA 2添加了一些用于使用地图构建三元关系的构造.但是,这个问题假定JPA 1或Hibernate 3.3.x并且我不喜欢使用map来对此进行建模.
ER模型http://db.grussell.org/co22001%20notes_files/image043.gif
替代三元关系的ER模型http://db.grussell.org/co22001%20notes_files/image045.gif
理想情况下,我更喜欢我的模型:
class SaleAssistant {
Long id;
//...
}
class Customer {
Long id;
//...
}
class Product {
Long id;
//...
}
class Sale {
SalesAssistant soldBy;
Customer buyer;
Product product;
//...
}
Run Code Online (Sandbox Code Playgroud)
问1.1)
我们如何对这种变化进行建模,其中每个Sale项目可能包含许多产品?
class SaleAssistant {
Long id;
//...
}
class Customer {
Long id;
//...
}
class Product {
Long id;
//...
}
class Sale {
SalesAssistant soldBy;
Customer buyer;
Set<Product> products;
//...
}
Run Code Online (Sandbox Code Playgroud)
问2)一般来说,我们如何用Hibernate建模n-ary,n> = 3的关系? …
关闭a java.sql.Connection还会关闭从该连接获得的所有语句,准备好的语句等吗?或者,如果我关闭连接但是保留语句等未公开会导致内存泄漏吗?
看起来像libxslt不支持XSLT 2.0,和xsl:result-document.有没有办法模仿xsl:result-document使用libxslt,或xsltproc?
使用Geb时,是否可以在使用Browser API(而不是Direct Download API)时设置自定义请求标头和用户代理?
虽然这可以通过FirefoxDriver(参见此处)实现,但我正在寻找一种使用WebKitDriver执行此操作的方法.
为异步方法提供Spring配置类:
@Configuration
@EnableAsync(proxyTargetClass = true)
@EnableScheduling
public class AsyncConfiguration {
@Autowired
private ApplicationContext applicationContext;
@Bean
public ActivityMessageListener activityMessageListener() {
return new ActivityMessageListener();
}
@Bean
public TaskExecutor defaultExecutor()
{
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
threadPoolTaskExecutor.setCorePoolSize(10);
threadPoolTaskExecutor.setMaxPoolSize(10);
threadPoolTaskExecutor.setQueueCapacity(Integer.MAX_VALUE);
return threadPoolTaskExecutor;
}
Run Code Online (Sandbox Code Playgroud)
我所有的@Async方法按预期工作,但如果我执行AsyncConfigurer到AsyncConfiguration为了赶实施异常getAsyncUncaughtExceptionHandler()的方法,我的豆子没有被代理这样的方法@Async并不在池中执行运行.
这是非工作配置:
@Configuration
@EnableAsync(proxyTargetClass = true)
@EnableScheduling
public class AsyncConfiguration implements AsyncConfigurer {
@Autowired
private ApplicationContext applicationContext;
@Bean
public ActivityMessageListener activityMessageListener() {
return new ActivityMessageListener();
}
@Override
public Executor getAsyncExecutor() { …Run Code Online (Sandbox Code Playgroud) 我可以在Web应用程序的各个JSP页面之间实现导航链接的最佳方法是什么?
假设我有一个list.jsp显示项目列表.然后,用户点击其中一个项目以查看更详细的项目view.jsp.现在我需要一个从view.jsp后面到的链接list.jsp.但是,list.jsp并不是唯一包含链接的页面view.jsp.例如,有可能去view.jsp,从search.jsp为好.除此之外,每个list.jsp和search.jsp可能具有影响它们产生的输出的不同参数和属性.
目前,我已经使用一个名为直接的方式实现了这一点,该参数source显示了用户点击的页面以转到当前页面,并在要记住的页面之间传递其他参数或属性.但是,我认为可能有一种以纯JSP + Servlet方式实现此类功能的最佳实践,我想在继续之前询问这个问题.
提前致谢.
是否有可能让JSF更新一个放在组件上下文之外的组件?
目前以下页面不起作用:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Welcome</title>
</h:head>
<h:body>
<p><h:outputText id="out" value="#{user.greeting}" /></p>
<h:form id="form1">
<h:inputText value="#{user.name}" id="user-name" />
<p><h:inputSecret value="#{user.password}" id="password" /></p>
<p>
<h:commandButton value="Login" id="login-button">
<f:ajax execute="user-name password" render="out" />
</h:commandButton>
</p>
</h:form>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
我知道,如果我把#out组件放在<h:form>页面内将会正确呈现.但有没有办法将#out组件放在表单之外(例如现在的位置)?
我希望获得有关部署到单个Tomcat实例的单服务器Java Web应用程序可以处理的工作负载规模的更多信息.特别是,让我假装我正在开发一个具有类似维基百科的使用模式的Wiki应用程序.如果我将服务器部署在具有以下配置的计算机上,我的服务器可以在内存不足之前可靠地处理多少请求,或者显示压力过大的迹象:
另外,我们假设MySQL数据库与Tomcat安装在同一台机器上,并且所有Wiki数据都存储在数据库中.此外,让我们假装Java应用程序构建在以下堆栈之上:
如果您没有使用确切的配置,但有评估类似架构的可扩展性的经验,我也会非常有兴趣听到这个.
提前致谢.
编辑:我想我没有正确地阐述我的问题.我用最多的投票标记答案作为最佳答案,我将在社区维基区重写我的问题.简而言之,我只想了解您在Java应用程序能够在一台物理服务器上处理的工作负载规模的经验,以及有关应用程序本身的类型和体系结构的一些描述.
是否有任何工具可用于记录JavaDocs等T/SQL脚本?例如,我希望能够记录包含以下创建语句的脚本:
/**
* This is a stored procedure.
*
* @param foo foo does bar
*/
create procedure my_proc(foo varchar(100)
...
GO
Run Code Online (Sandbox Code Playgroud) 很长一段时间以来,我注意到line-height在段落之间调整和添加一些相对于所选内容的额外空间font-size会对网站内容的可读性产生巨大影响,但到目前为止,我总是为这些属性选择ad-hoc值.
在排版,出版或心理学文献中是否有关于如何相对于彼此调整这些属性的值的建议?
java ×3
asynchronous ×1
cglib ×1
css ×1
cucumber-jvm ×1
geb ×1
hibernate ×1
html ×1
java-ee ×1
jdbc ×1
jpa ×1
jsf ×1
jsf-2 ×1
jsp ×1
libxslt ×1
orm ×1
scalability ×1
servlets ×1
spring ×1
spring-async ×1
sql-server ×1
typography ×1
xml ×1
xslt ×1