首页 \ 问答 \ 4.5.1也是4.0和4.5的就地升级吗?(Is 4.5.1 also in-place upgrade of 4.0 and 4.5?)

4.5.1也是4.0和4.5的就地升级吗?(Is 4.5.1 also in-place upgrade of 4.0 and 4.5?)

现在我们有.NET framework 4.5.1。 只是想知道4.5.1是否也是4.0和4.5的“就地升级”?


Now we have .NET framework 4.5.1. Just curious to know whether the 4.5.1 is also an "in place upgrade" for 4.0 and 4.5?


原文:
更新时间:2022-09-17 16:09

最满意答案

我不认为这是可能的, LIKE的左边部分应该是一个string_expression (在标准的JPA中)。 从规格:

4.6.9类似表达式

在条件表达式中使用比较运算符[NOT] LIKE的语法如下所示:

string_expression [NOT] LIKE pattern_value [ESCAPE escape_character]

string_expression必须有一个字符串值。 pattern_value是字符串文字或字符串值输入参数,其中下划线(_)代表任何单个字符,百分号(%)代表任何字符序列(包括空序列),所有其他字符代表为了自己。 可选的escape_character是单字符字符串文字或字符值输入参数(即charCharacter ),用于转义pattern_value中下划线和百分号字符的特殊含义。

enum_expression不是一个string_expression

以下工作虽然(使用枚举文字 ):

SELECT f 
  FROM Foo f 
 WHERE f.bar = com.acme.Bar.SOME_CONSTANT 
    OR f.bar = com.acme.Bar.SOME_OTHER_CONSTANT

另一个选择是将bar栏实际存储为一个String (并且在getter / setter中进行一些转换并将其转换为enum)。

参考

  • JPA 1.0规范
    • 第4.6.9节“像表达式”
    • 第4.14节“BNF”

I don't think it's possible, the left part of a LIKE is supposed to be a string_expression (in standard JPA). From the specification:

4.6.9 Like Expressions

The syntax for the use of the comparison operator [NOT] LIKE in a conditional expression is as follows:

string_expression [NOT] LIKE pattern_value [ESCAPE escape_character]

The string_expression must have a string value. The pattern_value is a string literal or a string-valued input parameter in which an underscore (_) stands for any single character, a percent (%) character stands for any sequence of characters (including the empty sequence), and all other characters stand for themselves. The optional escape_character is a single-character string literal or a character-valued input parameter (i.e., char or Character) and is used to escape the special meaning of the underscore and percent characters in pattern_value.

And an enum_expression is not a string_expression.

The following would work though (using enum literals):

SELECT f 
  FROM Foo f 
 WHERE f.bar = com.acme.Bar.SOME_CONSTANT 
    OR f.bar = com.acme.Bar.SOME_OTHER_CONSTANT

Another option would be to actually store the bar field as a String (and to do some conversion from and to an enum in the getter/setter).

Reference

  • JPA 1.0 Specification
    • Section 4.6.9 "Like Expressions"
    • Section 4.14 "BNF"

相关问答

更多
  • 您需要使用三角形括号作为内核启动语法的一部分: findMinMax<<>>(lum,&min_logLum,&max_logLum); 这应该解决编译错误,前提是其余的是正确的(例如,参数集与内核原型匹配)。 请注意,启动内核的方式还有一些其他问题: 您将每个网格的块数减少而不是向上。 例如,如果sizeof(lum)计算结果为1500,则仍然只启动1个1024个线程的块。 这可能不是你打算做的。 您将主机指针&min_logLum和&max_logLum传 ...
  • 假设您认为Name属性是string而不是int ( ( IEnumerable )Enum.GetValues(typeof(Colors)) ) .Select(ev => new Color() { Value = ev, Name = Enum.GetName(typeof(Colors), ev) }) .ToList(); Assumes you meant for the Name property to be ...
  • 我刚刚写了一个测试类,并在Hibernate / JPA 3.6.1中做了以下工作: SELECT o FROM Cat o ORDER BY CASE o.name WHEN 'Tom' THEN 0 ELSE 1 END I've just written a test class and the following works in Hibernate/JPA 3.6.1: SELECT o FROM Cat o ORDER BY CASE o.name WHEN 'Tom' T ...
  • 您发布的代码对我来说看起来很不错,CodePad在快速测试中编译它就好了。 所以虽然这个问题没有提到它,但我会猜测你在Visual Studio中工作。 在这种情况下,您看到的错误很可能是IntelliSense错误,而不是实际的编译器错误。 有时,IntelliSense引擎(使用不同的编译器实现)会感到困惑并报告您已经在代码中修复的错误。 重构现有代码时,我经常会注意到这个问题。 解决的办法是建立/编译你的项目并验证错误消失。 重建后应该会看到一个干净的“错误列表”窗口。 The code you've ...
  • 对于命名查询,(ORDER BY(a.id =:id)或ORDER BY(:id))将不起作用,因为DSC / ASC无法在运行时进行参数化。 1)如果排序元素在运行时变化,动态方式。 String query = "SELECT a FROM Article a ORDER BY "+orderElement+" DESC, a.id DESC"; entityManager.createQuery(query).getResultList(); 2)如果订购元素是固定的,则在实体bean中使用静态方式 ...
  • 我可以通过将枚举值转换为整数来解决其他地方,但这似乎是错误的,不知何故。 它不应该感到错误。 毕竟,这就是编译器本身所做的事情 - 它要么将枚举值替换为相应的数值(当枚举值在编译时已知),要么生成在运行时执行必要强制转换的代码。 请注意,这些强制转换不一定是int ,而是有问题的枚举的支持类型。 如果我可以在C#中的MyEnum值之间进行比较操作,那么为什么Expression构建器不允许它呢? 您正在构建的表达式树看起来与C#代码中发生的情况相匹配,但实际上并非如此 - 正是因为编译器在幕后工作所做的如上 ...
  • 不幸的是,您不能(直接)将case条件用作Bool表达式。 它们只能在if , guard , while , for等语句中访问。 这在语言语法中有详细说明,包括: case-condition → case ­pattern­ initializer­ 然后在以下condition : condition → expression |­ availability-condition |­ case-condition­ | optional-binding-condition (其中expression ...
  • 请检查以下内容。 if activity.activity_type?.id == LHActivityTypeID.Bike.rawValue { self?.allItems.append(activity) } Please check the below. if activity.activity_type?.id == LHActivityTypeID.Bike.rawValue { self?.allItems.append(activity) }
  • 没有,通常没有办法引用任何类中的字段,也不可能将参数传递给SELECT子句。 只有构造函数表达式的有效参数是(来自JPA 2.0规范,第174页) single_valued_path_expression scalar_expression aggregate_expression identification_variable No there is not, in general there is no way to reference to the fields in any class and i ...
  • 我不认为这是可能的, LIKE的左边部分应该是一个string_expression (在标准的JPA中)。 从规格: 4.6.9类似表达式 在条件表达式中使用比较运算符[NOT] LIKE的语法如下所示: string_expression [NOT] LIKE pattern_value [ESCAPE escape_character] string_expression必须有一个字符串值。 pattern_value是字符串文字或字符串值输入参数,其中下划线(_)代表任何单个字符,百分号(%)代表 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)