首页 \ 问答 \ 通过Javascript获取链接的价值(Getting the value of a link by Javascript)

通过Javascript获取链接的价值(Getting the value of a link by Javascript)

情况就是这样:我有一个只给出1或0的页面链接; http://www.mybilet.com/connectors/functionAjax.php?islem=getBosDoluKoltuk&serverId=228&showtimeId=46666

佩奇不是我的。 所以我想根据这个值在另一个页面中建立一个报警系统。 即如果值为1,则页面播放音乐。 如何获取此值并在Javascript中编写if语句。


Here is the situation: I have a link of a page that gives only 1 or 0; http://www.mybilet.com/connectors/functionAjax.php?islem=getBosDoluKoltuk&serverId=228&showtimeId=46666

Page is not mine. So I want to build an alarm system in another page according to this value. i.e. if the value is 1, the page plays a music. How can I get this value and write the if statement in Javascript.


原文:https://stackoverflow.com/questions/1943188
更新时间:2022-03-03 10:03

最满意答案

即使Hibernate是最常用的JPA实现,我也会坚持使用规范API(JPA)。
所以EntityManager而不是Session

通常,您想编写自己的查询,因为查询具有最低程度的复杂性。
但特定的JPA / Hibernate方法不允许执行这种查询。
这些方法只处理简单的情况。

因此,作为一般规则,您应该在每次可能时都支持特定的JPA / Hibernate方法而不是自定义查询创建。
通常是避免使用JPQL编写boiler plate代码的捷径。
例如,如果你想从它的ID中检索一个实体,那么你没有任何价值来写一个如此简单的查询。
你将不得不编写锅炉板代码(创建查询,设置参数查询,执行查询)。
使用EntityManager.find(Class<T>, Object)是一种更简单也更清晰的方法,因为您不需要进一步了解行为。

请注意,Spring Data JPA进一步提供了更多方法来处理其他经典查询。
SimpleJpaRepository类就是一个很好的例子。

最后,请注意,在某些情况下,特定的JPA / Hibernate方法来操纵实体并不是一种选择。
与实体或EntityManager状态相关的操作只能用这些方法( persist()flush()refresh()clear() ...)执行。


Even if Hibernate is the most commonly JPA implementation used, I would stick rather on the specification API (JPA).
So EntityManager rather than Session.

Generally you want to write your own queries as queries have a minimal level of complexity.
But specific JPA/Hibernate methods don't allow to perform this kind of queries.
These methods handle only simple cases.

So as a general rule, you should favor specific JPA/Hibernate methods over custom query creating at each time you may.
It is often a shortcut to avoid writing boiler plate code with JPQL.
For example if you want to retrieve a entity from its ID, you don't have any value to write at hand a so simple query.
You will have to write boiler plate code (creating query, setting parameter query, executing query).
Using EntityManager.find(Class<T>, Object) is a much simpler and also clearer approach as you don't need to go further to understand the behavior.

Note that Spring Data JPA goes still further by providing more methods to handle other classic queries.
The SimpleJpaRepository class is a good example.

At last, note that in some cases, specific JPA/Hibernate methods to manipulate entities are not a choice.
The operations related to the entities or the EntityManager state can be performed only with these methods (persist(), flush() or refresh(), clear(), ...).

相关问答

更多
  • 首先 - >我假设你使用了一个hibernate继承策略。 查询“来自用户”确实进行了休眠,不允许神奇地知道您只搜索客户。 您必须更改查询或整体机制。 示例解决方案 public class UserDaoImpl extends BaseDaoImpl implements UserDao,BaseDao { protected Class entityClass; public UserDaoImpl(Class enti ...
  • 我主要喜欢Criteria Queries来进行动态查询。 例如,根据一些参数,动态添加一些顺序或者留下一些部分(例如限制)更容易。 另一方面,我使用HQL进行静态和复杂的查询,因为它更易于理解/读取HQL。 另外,HQL有点强大,我想,例如对于不同的连接类型。 I mostly prefer Criteria Queries for dynamic queries. For example it is much easier to add some ordering dynamically or leav ...
  • 即使Hibernate是最常用的JPA实现,我也会坚持使用规范API(JPA)。 所以EntityManager而不是Session 。 通常,您想编写自己的查询,因为查询具有最低程度的复杂性。 但特定的JPA / Hibernate方法不允许执行这种查询。 这些方法只处理简单的情况。 因此,作为一般规则,您应该在每次可能时都支持特定的JPA / Hibernate方法而不是自定义查询创建。 通常是避免使用JPQL编写boiler plate代码的捷径。 例如,如果你想从它的ID中检索一个实体,那么你没有任 ...
  • 首先你的问题没有完全清除,首先在这里定义你的数据库模型,并从你的查询我已经知道 hql.append(" DOC.id, "); 这里不会添加最后一个Coma hql.append(“DOC.id”); 这里 hql.append(" FROM ").append(DocumentoAssinanteTO.class.getName()).append(" DA "); 你不需要通过调用class.getname()方法来获取类的名称,你只需要在这里调用bean或bean的名称。 你的内部联接中存在 ...
  • 您可以添加该客户类,如{c},并使用.addEntity('c',Customer.class),然后使用c.last_name的订单。 并建立客户与ProductDelivery的关系 you can add that customer class like {c} and use .addEntity('c', Customer.class) and then use the order by c.last_name. and make the relation of the Customer and ...
  • 不要连接HQL查询。 请改用命名参数 。 它是Hibernate中查询对象模式的一种实现。 对于你的情况: Session session = sessionFactory.getCurrentSession(); String selectQuery = "FROM Account as account WHERE account.username = :usernameParam"; Query query = session.createQuery(selectQuery); query.setPar ...
  • 试试这个查询: from Report where reportId = :reportId order by version desc with setMaxResults = 1 Try this query: from Report where reportId = :reportId order by version desc with setMaxResults=1
  • 使用视图。 请参阅: Hibernate Union替代方案 Use a View. See this: Hibernate Union alternatives
  • 看起来您正在使用二级缓存。 如果是这样,这也行不通。 select o from ObjectDao o where o.objectType.client.name = :clientName Looks like you are using Level 2 cache. If so this will not work either. select o from ObjectDao o where o.objectType.client.name = :clientName
  • 您的查询告诉数据库对满足WHERE子句的所有记录进行排序。 它有可能在返回前50之前对数百万条记录进行排序。 编辑1/26:现在澄清了具体问题,我将尝试更具体地回答。 每次执行这样的查询时,Hibernate都会进入数据库。 更重要的是,它会将会话中的所有新/更新数据刷新到磁盘。 如果这是您的情况,此行为可能会导致缓慢。 使用Hibernate查询API通常在大多数情况下都能很好地运行,并且与各种各样的数据库平台兼容。 如果您真的担心从数据访问层中挤出最后一滴性能,您可以编写自己的本机SQL查询来选择前50 ...

相关文章

更多

最新问答

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