我有一个管理3个数据库的应用程序.我在seam框架上使用了带JPA的hibernate.
所以我有一个persitence.xml文件,有三个像这样的persitence-unit(我删除了db2和db3的属性):
<persistence-unit name="db1" transaction-type="JTA" >
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>db1source</jta-data-source>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.connection.driver_class"
value="oracle.jdbc.driver.OracleDriver" />
<property name="hibernate.hbm2ddl.auto" value="validate" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.default_schema" value="SI_TEC" />
<property name="hibernate.validator.apply_to_ddl" value="false" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
</properties>
</persistence-unit>
<persistence-unit name="db2" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>d2source</jta-data-source>
</persistence-unit>
<persistence-unit name="db3" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>d3source</jta-data-source>
</persistence-unit>
Run Code Online (Sandbox Code Playgroud)
在我的seam components.xml文件中,我使用我的hibernate配置创建了3个managed-persistence-context来映射seam.
最后,我有几个实体,我的问题就在这里.我需要在db2和db3中的其他实体中保留一些实体.所以数据库模式是不同的,当我部署我的应用程序时,我收到此错误:
org.hibernate.HibernateException: Missing table: PORTAILPERMISSION
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1113)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:349)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
Truncated. see log file for complete stacktrace
Run Code Online (Sandbox Code Playgroud)
因为,db2中不存在表PORTAILPERMISSION. …
我有'更新'钩子的问题.在新分支的情况下,它获得0000000000000000000000000000000000000000作为'oldrev'.我不知道如何处理这种情况.
我们要求每个提交消息都引用有效的Jira问题.所以我在我们的中央存储库上安装了一个"更新"钩子.那个钩子得到了"oldrev"和"newrev".然后我将这些传递给"git rev-list",如下所示:
git rev-list $oldrev..$newrev
这给了我所有转速的列表,然后我可以迭代,并做我需要做的任何事情.
问题是,当用户推送新分支时,钩子获得0000000000000000000000000000000000000000作为oldrev.而"git rev-list"只是抱怨:
fatal: Invalid revision range 0000000000000000000000000000000000000000..21bac83b2
那么如何获得该新分支上所有转速的列表?我已经搜索网了很长一段时间了,一无所获.我找到了示例钩子
这些听起来都不是特别刺激.
那么有人知道如何在这种情况下得到正确的答案吗?我正在考虑查询git"给我所有可以从newrev到达的转,但不能从任何其他分支(=除了新分支之外的所有分支)".但是,如果从新分支到任何旧分支的合并,即使这样也会给出错误的答案.
我想知道如何构建一个函数,它给出颜色代码并显示这种颜色的渐变.例如:
function generate_color(int colorindex)
{ .......
.......
Generate 10 pale colors of this color.
}
Run Code Online (Sandbox Code Playgroud)
请帮我
我遇到过一个场景,其中Entity Framework 4.0没有生成与具有唯一索引的表支持的实体的关联,我想知道为什么.
基本设置是这样的:假设我在SQL Server 2008 R2中有两个表和一个外键关系:
CREATE TABLE [dbo].[User](
[Id] [int] IDENTITY(1,1) NOT NULL,
[GroupId] [int] NULL,
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[Group](
[Id] [int] IDENTITY(1,1) NOT NULL,
CONSTRAINT [PK_Group] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = …Run Code Online (Sandbox Code Playgroud) I have several web modules. There are dependency between them, say during startup, module B will use MBean exposed by module A. How to configure glassfish to enable it start them by specific order? Or is it possible to configure it to load them concurrently.
I searched quite a lot via google, but not result.
顺便说一下,我正在使用glassfish-2
在eclipse下是否有针对reStructuredText的WiKiText编辑器插件?当我编辑.textile文件时,我会获得各种智能编辑功能(例如折线)和预览面板.我发现在各种MyLyn包下都有对reStructuredText的引用,但是在安装它们之后我仍然找不到reStructuredText编辑器.是因为没有一个吗?
谢谢.肯特
我如何从PHP中的字符串中获取"filesize"?
我将字符串作为blob放在mysql数据库中,我需要存储blob的大小.我的解决方案是创建一个临时文件并将字符串放入临时文件中.现在我可以从"字符串"中获取文件大小.但那解决方案并不好......
问候
为了简化,我试图使用ifstream类及其getline()成员函数来读取CSV文件的内容.这是这个CSV文件:
1,2,3
4,5,6
Run Code Online (Sandbox Code Playgroud)
和代码:
#include <iostream>
#include <typeinfo>
#include <fstream>
using namespace std;
int main() {
char csvLoc[] = "/the_CSV_file_localization/";
ifstream csvFile;
csvFile.open(csvLoc, ifstream::in);
char pStock[5]; //we use a 5-char array just to get rid of unexpected
//size problems, even though each number is of size 1
int i =1; //this will be helpful for the diagnostic
while(csvFile.eof() == 0) {
csvFile.getline(pStock,5,',');
cout << "Iteration number " << i << endl;
cout << *pStock<<endl;
i++;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我期待读取所有数字,因为getline假定自上次读取后写入,并在遇到','或'\n'时停止. …
I have lots of small pieces of code that look like:
for it in <iterable>:
if <condition>:
return True/False
Run Code Online (Sandbox Code Playgroud)
Is there a way I can rewrite this piece of code with a lambda expression ? I know I can factor it out in a small method/function, but I am looking for some lambda thing if it can be done.
我现在已经实现了一些Java应用程序,到目前为止只有桌面应用程序.我更喜欢使用不可变对象在应用程序中传递数据,而不是使用带有mutator(setter 和getter)的对象,也称为JavaBeans.
但是在Java世界中,使用JavaBeans似乎更常见,我无法理解为什么我应该使用它们.就个人而言,如果代码只处理不可变对象而不是一直改变状态,那么代码看起来会更好.
第15项中还建议使用不可变对象:最小化可变性,有效Java 2ed.
如果我有一个Person实现为JavaBean的对象,它看起来像:
public class Person {
private String name;
private Place birthPlace;
public Person() {}
public setName(String name) {
this.name = name;
}
public setBirthPlace(Place birthPlace) {
this.birthPlace = birthPlace;
}
public String getName() {
return name;
}
public Place getBirthPlace() {
return birthPlace;
}
}
Run Code Online (Sandbox Code Playgroud)
并且Person实现为不可变对象:
public class Person {
private final String name;
private final Place birthPlace;
public Person(String name, …Run Code Online (Sandbox Code Playgroud)