首页 \ 问答 \ 不同应用程序上的jpa实体(jpa entities on different applications)

不同应用程序上的jpa实体(jpa entities on different applications)

我有一个基于java后端集成应用程序(无UI)的spring / jpa。 现在我正在创建一个UI Web应用程序(也是基于spring / jpa),以支持后端应用程序上的查询。 所以我将使用相同的DB有两个应用程序(jvms)。 我的问题是 - 后端集成应用程序在数据库中的变化是否会反映在UI应用程序的jpa实体上? 或者我必须强迫我的实体总是去DB,以便及时更新?


I have a java backend integration application (no UI) spring/jpa based. now I am creating a UI web application (also spring/jpa based) to support queries on the backend application. So I will have two applications (jvms) using the same DB. My question is - will cahanges in the DB made by the backend integration application , be reflected on the jpa entities of the UI application ? or I have to force my entities to always go to the DB in order to be up to date ?


原文:https://stackoverflow.com/questions/46502252
更新时间:2021-10-19 09:10

最满意答案

SELECT name
FROM tbl1 
ORDER BY sequence = 0,
         sequence ASC

要么

SELECT name
FROM tbl1 
ORDER BY case when sequence <> 0 then 1 else 2 end,
         sequence ASC

SELECT name
FROM tbl1 
ORDER BY sequence = 0,
         sequence ASC

or

SELECT name
FROM tbl1 
ORDER BY case when sequence <> 0 then 1 else 2 end,
         sequence ASC

相关问答

更多
  • 您可以通过在每个选择中添加一个名为rank的伪列,您可以先排序,然后再按其他条件进行排序,例如: select * from ( select 1 as Rank, id, add_date from Table union all select 2 as Rank, id, add_date from Table where distance < 5 union all select 3 as Rank, id, add_date from Table where ...
  • 无法查看所有数据,我最好的猜测是Group By正在合并数据并为您提供与Where子句匹配的任意值。 如果酒店名称不是唯一的,则会发生这种情况,除非您专门查询,否则您将无法获得最高分。 尝试在deal_score周围放置一个Max() 。 在MySQL中,Group By可以太容易使用,我喜欢MSSQL如何强制使用聚合函数并按每个未聚合的字段进行分组。 试试这个查询: SELECT `hotel_name`, MAX( `deal_score` ) AS `max_score` FROM `packages ...
  • 由于in的项目列表,很难优化此查询。 引擎基本上可以采用两种方法来进行这些查询。 使用where子句的索引。 然后进行排序或使用oder by的索引。 因为在where存在不等式( in “不等式”中),所以索引不能直接用于where 。 where的最佳索引是: items(external_item_id, status_id)和items(external_item_id, time_stamp) 。 另一种执行计划是使用order by索引,然后即时过滤。 这建议尝试: items(time_sta ...
  • SELECT name FROM tbl1 ORDER BY sequence = 0, sequence ASC 要么 SELECT name FROM tbl1 ORDER BY case when sequence <> 0 then 1 else 2 end, sequence ASC SELECT name FROM tbl1 ORDER BY sequence = 0, sequence ASC or SELECT name FR ...
  • SQL(所有服务器和服务器的型号)使用索引来满足查询的方式比您想象的要复杂一些。 通常先通过筛选(WHERE)然后排序来满足查询。 对于您向我们显示的确切查询,如果您在(fk,listorder)上有复合索引,则SQL引擎将能够使用索引来满足查询的两个子句。 索引将首先由WHERE子句随机访问,然后它将按照满足排序条款的顺序。 阅读: http : //use-the-index-luke.com/ 更新复合索引并不比更新单列索引昂贵得多。 无论哪种方式,使用索引都要比扫描表的WHERE操作要好。 The ...
  • 这是对Raina方法的改进。 该方法存在两个问题。 第一个是子查询中的order by 。 无法保证子查询中的订单会以相同的顺序生成结果(它通常在MySQL中实际运行,但您不应该依赖于该行为)。 第二个是在select有多个变量赋值。 MySQL不保证分配顺序。 更安全的写作方式是: SELECT id, price, category FROM (SELECT (@rownum := IF(@cat = t.category, @rownum + 1, ...
  • 您正在按字符串列排序; 改用数字列 select batchno,fperiod,date,reference,desp,"7.00" as taxpec,sequal, if(creditamt-debitamt='0.00','0.00',(creditamt-debitamt)*-1 ) as kdebitamt from glpost where rem4='SR'and reference="INV-A00428" and (fperiod between '1' and '11' AND gst ...
  • 您可以将查询包装在子查询中,并在外部查询中执行过滤: SET @day := 0, @id:= ''; SELECT day, id, day_number FROM ( SELECT day, id, @day := IF(@id = id, @day + 1, IF(@id := id, 1, 1)) as day_number FROM myTable WHERE month = EXTRAC ...
  • 答案在于问题: 我确实找到了这个: https : //dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html其中连字符列在“你使用带表达式的 ORDER BY ......”下面 这里的关键字是“表达式” 。 您可以在ORDER BY子句中使用表达式。 ORDER BY -order_line_groups.sequence DESC 是一个算术表达式,“连字符”不是连字符而是减号; 一元减数学运算符。 怎么运行的? 关于结果,它按预期工作: ...

相关文章

更多

最新问答

更多
  • 您如何使用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)