首页 \ 问答 \ Nhibernate和linq问题(Nhibernate and linq problem)

Nhibernate和linq问题(Nhibernate and linq problem)

我得到以下表达式:

_senderRepos.Get(s => s.User.Email == fromAddress);

这导致了

could not resolve property: User.Email of: Module.Fax2Pdf.MailToFax.Models.Sender

类:

public class Sender
{
    public virtual int Id { get; set; }
    public virtual Site Site { get; set; }
    public virtual User User { get; set; }
}

制图:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true">
  <class name="Module.Fax2Pdf.MailToFax.Models.Sender, Module.Fax2Pdf" table="fax_allowed_senders">
    <id name="Id" column="id">
      <generator class="sequence">
        <param name="sequence">fax_allowed_senders_id_seq</param>
      </generator>
    </id>
    <many-to-one column="site_id" name="Site" />
    <many-to-one column="user_id" name="User" />
  </class>
</hibernate-mapping>

而User类DO在其映射文件中有一个Email属性。 我究竟做错了什么?

更新,用户映射

    <?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="false">
  <class name="Gate.Users.User, Gate.Models" table="users">
    <id name="Id" column="id">
      <generator class="sequence">
        <param name="sequence">users_id_seq</param>
      </generator>
    </id>
    <many-to-one column="site_id" name="Site" />
    <property name="FirstName" column="first_name" type="String" length="30"/>
    <property name="LastName" column="last_name" type="String" length="30"/>
    <property name="CanDelete" column="can_delete" type="boolean" />
    <property name="Email" column="email" type="String" length="255"/>
    <property name="Department" column="department" type="String" length="30"/>
    <property name="Title" column="title" type="String" length="30"/>
    <many-to-one class="Gate.Extensions.Extension, Gate.Models" column="extension_id" name="Extension" />
    <property name="Status" column="status" type="integer" />
    <property name="CreatedAt" column="created_at" />
    <property name="UpdatedAt" column="updated_at" />
    <property name="TimeZone" column="timezone" type="integer" />
    <property name="MiddleNames" column="middle_names" type="string" />
    <property name="NamePrefix" column="name_prefix" type="string" />
    <property name="NameSuffix" column="name_suffix" type="string" />
    <property name="DateOfBirth" column="dob" />
    <property name="RemovedAt" column="removed_at" />
    <property name="ProxyMedia" column="proxy_media" type="boolean" />
  </class>
</hibernate-mapping>

I get the following expression:

_senderRepos.Get(s => s.User.Email == fromAddress);

which results in

could not resolve property: User.Email of: Module.Fax2Pdf.MailToFax.Models.Sender

class:

public class Sender
{
    public virtual int Id { get; set; }
    public virtual Site Site { get; set; }
    public virtual User User { get; set; }
}

mapping:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true">
  <class name="Module.Fax2Pdf.MailToFax.Models.Sender, Module.Fax2Pdf" table="fax_allowed_senders">
    <id name="Id" column="id">
      <generator class="sequence">
        <param name="sequence">fax_allowed_senders_id_seq</param>
      </generator>
    </id>
    <many-to-one column="site_id" name="Site" />
    <many-to-one column="user_id" name="User" />
  </class>
</hibernate-mapping>

And the User class DO have a Email property in it's mapping file. What am I doing wrong?

Update, user mapping

    <?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="false">
  <class name="Gate.Users.User, Gate.Models" table="users">
    <id name="Id" column="id">
      <generator class="sequence">
        <param name="sequence">users_id_seq</param>
      </generator>
    </id>
    <many-to-one column="site_id" name="Site" />
    <property name="FirstName" column="first_name" type="String" length="30"/>
    <property name="LastName" column="last_name" type="String" length="30"/>
    <property name="CanDelete" column="can_delete" type="boolean" />
    <property name="Email" column="email" type="String" length="255"/>
    <property name="Department" column="department" type="String" length="30"/>
    <property name="Title" column="title" type="String" length="30"/>
    <many-to-one class="Gate.Extensions.Extension, Gate.Models" column="extension_id" name="Extension" />
    <property name="Status" column="status" type="integer" />
    <property name="CreatedAt" column="created_at" />
    <property name="UpdatedAt" column="updated_at" />
    <property name="TimeZone" column="timezone" type="integer" />
    <property name="MiddleNames" column="middle_names" type="string" />
    <property name="NamePrefix" column="name_prefix" type="string" />
    <property name="NameSuffix" column="name_suffix" type="string" />
    <property name="DateOfBirth" column="dob" />
    <property name="RemovedAt" column="removed_at" />
    <property name="ProxyMedia" column="proxy_media" type="boolean" />
  </class>
</hibernate-mapping>

原文:https://stackoverflow.com/questions/4616972
更新时间:2022-07-26 11:07

最满意答案

最简单的路由可能是升级或重新安装Java运行时环境(JRE)。

或这个:

  • 打开Windows资源管理器,从工具中选择'文件夹选项...'
  • 单击文件类型选项卡,向下滚动并选择JAR文件类型。
  • 按高级按钮。
  • 在编辑文件类型对话框中,选择在“操作”框中打开,然后单击“编辑”...
  • 按浏览按钮并导航到Java解释器javaw.exe的位置。
  • 在用于执行操作字段的应用程序中,需要显示类似于C:\Program Files\Java\j2re1.4.2_04\bin\javaw.exe" -jar "%1" %注释(注意:以”javaw “必须完全一样;路径名称的另一部分可能会根据您使用的Java版本而有所不同),然后按确定按钮,直到所有对话框关闭。

从这里被盗: http : //windowstipoftheday.blogspot.com/2005/10/setting-jar-file-association.html


Easiest route is probably upgrading or re-installing the Java Runtime Environment (JRE).

Or this:

  • Open the Windows Explorer, from the Tools select 'Folder Options...'
  • Click the File Types tab, scroll down and select JAR File type.
  • Press the Advanced button.
  • In the Edit File Type dialog box, select open in Actions box and click Edit...
  • Press the Browse button and navigate to the location the Java interpreter javaw.exe.
  • In the Application used to perform action field, needs to display something similar to C:\Program Files\Java\j2re1.4.2_04\bin\javaw.exe" -jar "%1" % (Note: the part starting with 'javaw' must be exactly like that; the other part of the path name can vary depending on which version of Java you're using) then press the OK buttons until all the dialogs are closed.

Which was stolen from here: http://windowstipoftheday.blogspot.com/2005/10/setting-jar-file-association.html

相关问答

更多
  • 如果您阅读文档(在命令行中键入help for或for /? ),那么您将看到执行FOR循环的正确语法固定次数。 for /L %%i in (1 1 %numToRun%) do java -jar Lab1.jar %numParam% %strParam% 如果你想使用多行,那么你必须使用续行 for /L %%i in (1 1 %numToRun%) do ^ java -jar Lab1.jar %numParam% %strParam% 或括号 for /L %%i in (1 1 % ...
  • 右键单击列出 - >打开方式? 是否有其他程序列为默认程序? 是否列出了Java Runtime? 如果列出了Java运行时,您可以使用它运行,并将其作为运行的默认程序。 即 Right Click -> Properties -> Change -> C:\Program Files\Java\jre7\bin\javaw.exe What is listed in right-click-> Open With ? Is some other program listed as the defaul ...
  • 最简单的路由可能是升级或重新安装Java运行时环境(JRE)。 或这个: 打开Windows资源管理器,从工具中选择'文件夹选项...' 单击文件类型选项卡,向下滚动并选择JAR文件类型。 按高级按钮。 在编辑文件类型对话框中,选择在“操作”框中打开,然后单击“编辑”... 按浏览按钮并导航到Java解释器javaw.exe的位置。 在用于执行操作字段的应用程序中,需要显示类似于C:\Program Files\Java\j2re1.4.2_04\bin\javaw.exe" -jar "%1" %注释(注 ...
  • 使用批次代码 @echo off set "DateOption=2015-07-07" java.exe -jar my.jar %DateOption% set "DateOption=" 或者甚至更好 @echo off set "DateOption=2015-07-07" "%JAVA_HOME%\bin\java.exe" -jar my.jar %DateOption% set "DateOption=" 根据cmd.exe在运行批处理文件时输出的命令,看起来第二行中my.jar和%d%之 ...
  • 修复了,只需在运行我的Jar文件链接之前添加一个/W前缀。 这意味着下一个过程在完成之前不会开始。 最终批处理文件(.bat)如下所示: START startNetworkServer.lnk PING 1.1.1.1 -n 1 -w 5000> NUL START / W Run.exe.lnk START stopNetworkServer.lnk Ĵ Fixed, just had to add a /W prefix before running my Jar file link. This me ...
  • 我设法通过匹配HKEY_CURRENT_USER和HKEY_LOCAL_MACHINE注册表项中的路径在Open with列表中获得Java™Platform SE二进制文件 (javaw.exe) : HKEY_CURRENT_USER \ Software \ Classes下\ jar_auto_file \壳\开放\命令 HKEY_LOCAL_MACHINE \ SOFTWARE \ Classes下\ jar文件\壳\开放\命令 看起来像指向旧版Java的条目之一。 现在.jar文件终于显示图标, ...
  • 如果您没有使用依赖于操作系统的命令,例如从java运行Windows命令(不能在linux中运行)或使用特定于Windows的模块,那么您的java将在所有其他操作系统中运行。 这是跨平台的java最重要的功能之一,您可以在安装了特定于操作系统的Java运行时环境的不同操作系统中运行您的代码。 所以在所有操作系统中,只需要运行即可 java -jar yourjarfile.jar If you've not used an operating system dependent commands like ...
  • 我能说的最好的是按Win + R并键入regedit.exe,按Enter键。 在注册表编辑器窗口中,展开HKEY_CURRENT_USER->Software->Microsoft->Windows->CurrentVersion->Explorer->FileExts 从列表中删除条目或密钥名称.jar。 请检查NetBeans使用的版本以及类路径上的版本。 希望它们都是相同的版本,它也可能是其中一个原因,因为.jar不起作用。 现在再次尝试运行.jar文件。 这可能有助于它再次运行。 问候 The b ...
  • 其中一种方法是获取类代码源的URL,例如 URL r = JdbcTemplate.class.getProtectionDomain().getCodeSource().getLocation(); System.out.println(r); 版画 file:/D:/.repository/org/springframework/spring-jdbc/3.2.4.RELEASE/spring-jdbc-3.2.4.RELEASE.jar 在我的项目中 One of the way ...
  • 如果你可以在Windows资源管理器上找到它你可以做什么它去文件的位置(在Windows资源管理器中) shift + rightClick在空白区域,然后选择open command prompt here并尝试执行java Electronics.jar if you can find it on windows explorer what you can do it's go to the location of the file (while in windows explorer) shift + ...

相关文章

更多

最新问答

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