首页 \ 问答 \ 语义和语法是一样的吗?(Are semantics and syntax the same?)

语义和语法是一样的吗?(Are semantics and syntax the same?)

“语义”和“语法”之间的含义有什么区别? 他们是什么?

此外,“语义网站与普通网站”,“语义社交网络与正常社交网络”等有什么区别?


What is the difference in meaning between 'semantics' and 'syntax'? What are they?

Also, what's the difference between things like "semantic website vs. normal website", "semantic social networking vs. normal social networking" etc.


原文:https://stackoverflow.com/questions/209979
更新时间:2022-11-27 06:11

最满意答案

为什么不。 你可以做到这一点。 Hibernate允许。

由于您使用的是事务管理,因此答案取决于您的上下文。 如果要保存两个对象而不管另一个对象是否在单个事务中更新它们。

如果您想成功保存整个信息,并希望在任何更新失败时还原所有内容,请将它们保留为当前格式。


Why not. You can do that. Hibernate allows.

Since you are using Transaction management the answer is depends on your context. If you want to save both Objects regardless of saving another make them update in individual transactions.

If you want to save the whole info successfully and want to revert everything if any of the update fail keep them in the current format.

相关问答

更多
  • 你可以试试这个: DataaccessClass: public boolean update(YourClass yourObject) { Transaction transaction = null; boolean result = false; try { SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); Session session = sessionFa ...
  • 为什么不。 你可以做到这一点。 Hibernate允许。 由于您使用的是事务管理,因此答案取决于您的上下文。 如果要保存两个对象而不管另一个对象是否在单个事务中更新它们。 如果您想成功保存整个信息,并希望在任何更新失败时还原所有内容,请将它们保留为当前格式。 Why not. You can do that. Hibernate allows. Since you are using Transaction management the answer is depends on your context. ...
  • 很可能是因为B对象不是指同一个Java C对象实例。 它们指的是数据库中的同一行(即相同的主键),但它们是不同的副本。 那么正在发生的是Hibernate会话,它正在管理这些实体将跟踪哪个Java对象与具有相同主键的行对应。 一个选项是确保引用同一行的对象B的实体实际上引用了C的相同对象实例。或者关闭该成员变量的级联。 这样当B持续时C不是。 您将不得不手动另存C。 如果C是一个类型/类别表,那么这可能是有道理的。 Most probably its because the B objects are no ...
  • 您可以使用@Transactional将事务范围设置为服务级别方法,然后更新从数据库获取的“实时”实体。 例如: @Transactional public void editUser(int userId, User editUser) { User liveUser = getUserDAO().findByPrimaryKey(userId); liveUser.setNameFirst(editUser.getNameFirst()); liveUser.setNameLas ...
  • 如果在类型A和B子实体集合上正确设置了id,并且您已在这些实体上指定了cascade=MERGE ,则应该能够使用合并方法,例如, A updatedEntity = dao.merge(yourObjectFromTheHttpSession); 也就是说,我必须手动协调相关集合以正确处理新的传入实体并删除过去的现有实体,并且无法依靠hibernate自动处理所有事情,因此YMMV。 来自文档: 将给定对象的状态复制到具有相同标识符的持久对象上。 如果当前没有与会话关联的持久性实例,则将加载该实例。 返 ...
  • 没有指定具体问题(没有评论行)。 我读到了这样的问题 - “我已经在xml文件中注入了SessionFactory bean。现在,我想在Java程序中重新收集它。” 简单! ApplicationContext context = new FileSystemXmlApplicationContext("c:/../application-hibernate.xml"); SessionFactory sessionFact = (SessionFactory) context.getBean("sess ...
  • 我的猜测是在DAOMyObject.getInstance().deleteObjectWithZeroQuantities(iSession)进行查询以获取数据库 。 但是,在DB中,您的iObject.getQuantity()仍然是!=0 ,因此不会被删除。 为什么您的查询命中数据库而不是使用Session缓存的iObject实例? 那是因为查询必须检索quantity != 0 所有实体 ,并且您没有缓存所有实体 。 Session的第一级缓存通常在按ID检索实体时使用,查询形式为select * ...
  • 您可以将对象重新附加到新会话中,就像您在帖子中描述的一样,或者通过使用FetchType.EAGER作为获取类型来禁用延迟初始化, FetchType.EAGER : @OneToMany(fetch = FetchType.EAGER) private Map attributes = new HashMap(); 有关懒惰和提前获取之间差异的更多信息,请参阅此文章: Java Persistence API中的FetchTyp ...
  • 我解决了我的问题。 问题在于hbm问题行的错误配置: I solve my problem. The problem was in wrong configuration of hbm Problematic lines:
  • 看起来会话对象的更新滞后。 它并不滞后。 问题是,最初您的session没有任何内容,因此您的HTML页面和您的javascript等同于window.alert() 。 更新session ,重新呈现页面将javascript代码更新为window.alert('a_id') 。 有没有办法确保Flask函数对会话对象所做的更新立即反映出来? 您可以检查您的javascript回调以检查cookie返回。 Cookie已加密,因此除非您知道如何解密,否则您将看不到该值。 不建议这样做。 但是,至少可以看到 ...

相关文章

更多

最新问答

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