问题列表 - 第25996页

JPA @TableGenerator在多个实体之间共享

我有一个带有@Id和@TableGenerator的'dog'Entitiy

...
@TableGenerator(table = "seq", name = "dog_gen", pkColumnName = "seq_name", valueColumnName="seq_val")
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "dog_gen")
private Long id;
...
Run Code Online (Sandbox Code Playgroud)

有没有办法在其他实体中重用相同的表生成器(dog_gen)?我想在两个独立的实体中保持相同的id序列

dog = 1,dog = 2,dog = 3,cat = 4,cat = 5,dog = 6等等......

两个实体不共享一个公共超类来实现与id属性的某种继承.

如果我添加了@GeneratedValue(发电机="dog_gen")对我的猫实体,省略@TableGenerator声明抛出一个异常说开始的背景下,当它找不到发电机.

Caused by: org.hibernate.AnnotationException: Unknown Id.generator: dog_gen
at org.hibernate.cfg.BinderHelper.makeIdGenerator(BinderHelper.java:413)
at org.hibernate.cfg.AnnotationBinder.bindId(AnnotationBinder.java:1795)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1229)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:498)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277) 
Run Code Online (Sandbox Code Playgroud)

java orm hibernate jpa

6
推荐指数
1
解决办法
5867
查看次数

获取两个地理点之间的距离

我想制作一个应用程序来检查用户所在的最近的地方.我可以很容易地获得用户的位置,我已经有了纬度和经度的地方列表.

知道列表最近的位置与当前用户位置的最佳方法是什么.

我在谷歌API中找不到任何东西.

maps android geolocation

107
推荐指数
4
解决办法
14万
查看次数

TFS 2010中的禁止模式登记政策

我一直在尝试使用TFS 2010 Power Tools的Forbidden Patterns部分而我只是不理解某些东西 - 我试图使用它时根本无法改变任何东西!我正在使用最近发布的版本(我相信2010年4月23日),所以它不是旧版本.

首先,是的,我知道它是基于正则表达式的,所以让我们明白这个疑问......

我试图阻止以下场景:

1)我修改了所有T4 EF模板以生成名为的文件EntityName.gen.cs.然后我试图阻止TFS想要检查那些文件.我使用正则表达式\.gen\.cs\z并没有改变一件事!我甚至没有\z和nadda一起尝试过!

2)我不希望默认情况下签入app.config和web.config文件,因为我们将这些内容存储到app.config.base和web.config.base文件中,我们的构建脚本用它来生成我们的-environment app.config和web.config文件.因此,我尝试了以下正则表达式,再次,没有任何作用!web\.config\z,app\.config\z,web\.release\.config\zweb\.debug\.config\z.

我搞砸了这个是什么东西?

regex tfs visual-studio-2010 tfs-power-tools

6
推荐指数
2
解决办法
4160
查看次数

每个节点的XSL唯一值

好吧,我有这个xml

<roots>
<root>
    <name>first</name>
    <item type='test'><something>A</something></item>
    <item type='test'><something>B</something></item>
    <item type='test'><something>C</something></item>
    <item type='test'><something>A</something></item>
    <item type='other'><something>A</something></item>
    <item type='test'><something>B</something></item>
    <item type='other'><something>D</something></item>

</root>
<root>
<name>second</name>
    <item type='test'><something>E</something></item>
    <item type='test'><something>B</something></item>
    <item type='test'><something>F</something></item>
    <item type='test'><something>A</something></item>
    <item type='other'><something>A</something></item>
    <item type='test'><something>B</something></item>
    <item type='other'><something>D</something></item>

</root>

</roots>
Run Code Online (Sandbox Code Playgroud)

现在我需要获得每个根节点的唯一值到目前为止我有

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output indent="yes" method="text"/>
  <xsl:key name="item-by-value" match="something" use="."/>
  <xsl:key name="rootkey" match="root" use="name"/>

  <xsl:template match="/">
    <xsl:for-each select="key('rootkey','second')">
      <xsl:for-each select="item/something">
        <xsl:if test="generate-id() = generate-id(key('item-by-value', normalize-space(.)))">
          <xsl:value-of select="."/>
        </xsl:if>
      </xsl:for-each> 
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)

如果我使用"First"作为获得第一根的关键我得到一个好的结果ABCD

如果我使用"秒"我怎么只得到EF但我需要结果是ABDFE

xslt unique

5
推荐指数
1
解决办法
1560
查看次数

在IE上阅读URL Anchor

我有一个页面,其中包含指向另一个页面的链接,最后有锚点(如下所示:index.html#anchor).在他们指向的页面上,我有一个脚本应该读取锚指向的位置以显示某些内容.

在firefox上它完美无缺,但我注意到IE似乎从URL的末尾删除了#anchor,因此脚本无法抓取文本.有没有办法解决这个问题,没有任何服务器端代码?

html javascript anchor

9
推荐指数
1
解决办法
1801
查看次数

使用jQuery从纯HTML网站调用.net webservice

我想知道可以使用jQuery从HTML页面调用托管的.net Web服务吗?我尝试了这段代码,但它对我不起作用:

 $('#myForm').click(function() {
        $.ajax({
            type: "POST",
            data: '{}',
            url: "http://localhost:49590/Service.asmx?op=HelloWorld",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success:
                function(response) {                   
                    alert(response.d);
                },
            failure:
                function(result) {
                    alert(result.status + ' ' + result.statusText);
                }
        });
    });
Run Code Online (Sandbox Code Playgroud)

Web服务就是这样的:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{

    [WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }
}
Run Code Online (Sandbox Code Playgroud)

我搜索过这个,只找到了从asp.net或asp.net mvc项目完成的例子.我不确定我错过了什么,但我认为这可以从一个简单的HTML网站使用javascript,所以有人可以指出我正确的方向.

干杯!

.net jquery web-services

3
推荐指数
1
解决办法
8037
查看次数

ASP.NET调试与IIS一起计时

终于崩溃并寻求帮助,我的客户/ iis(不确定哪个)通常在大约30s-1分钟后超时我调试(踩代码)这不仅导致我失去了我的位置而且必须重新开始(通常是踩踏)更快,犯更多错误)但IIS调试会话完全关闭,我必须再次热身整个会话.

什么是从调试会话中获得更多时间的最佳方法?

在IIS 7.5 Classic Pipeline上调试vanilla 3.5 Web 站点(而不是app)

asp.net iis debugging

32
推荐指数
2
解决办法
3万
查看次数

为脚本标记提供ID

我遇到了一个场景,给script元素一个id属性可以轻松解决问题.然而,在阅读了w3schoolsquirksmodescript元素后,似乎这样做可能会产生一些不可预见的后果.

有没有人遇到任何与浏览器有关的问题,如Chrome,Safari,FF3和IE 7?

html scripting standards

60
推荐指数
4
解决办法
5万
查看次数

什么是int,string,array,list,object等可接受的命名约定

我现在工作的公司为它们的C#变量使用一组命名约定,例如iSomeName用于int,sSomeName用于字符串,aSomeName用于数组,bSomeName用于布尔值,dSomeName用于datetime等等.我以前的雇主没有使用i,s,a,b和d前缀,只是将变量命名为一个很好理解的名称.我的印象是,这些前缀在不久前失宠了,从我读到的不是当前的趋势.对我来说似乎很好,只要变量具有足够的描述性来理解它正在做什么,但我想知道现在一天接受的做法是命名变量?

.net c# programming-languages

9
推荐指数
3
解决办法
3850
查看次数

如何查看哪个jQuery函数绑定到该元素?

我在javascript中找到了一个具有我需要的功能的网站.它使用jQuery,当我点击一个标签时,会执行一些函数,所以jQuery为标签设置了一个绑定.但是我怎样才能找出哪个函数与它绑定在一起呢?Firebug没有向我展示:(

javascript jquery firebug

5
推荐指数
1
解决办法
428
查看次数