{"action":"closed","issue":{"url":"https://api.github.com/repos/querydsl/querydsl/issues/1459","labels_url":"https://api.github.com/repos/querydsl/querydsl/issues/1459/labels{/name}","comments_url":"https://api.github.com/repos/querydsl/querydsl/issues/1459/comments","events_url":"https://api.github.com/repos/querydsl/querydsl/issues/1459/events","html_url":"https://github.com/querydsl/querydsl/issues/1459","id":97715508,"number":1459,"title":"HibernateDomainExporter and inheritance with composite-id","user":{"login":"vveloso","id":796099,"avatar_url":"https://avatars.githubusercontent.com/u/796099?v=3","gravatar_id":"","url":"https://api.github.com/users/vveloso","html_url":"https://github.com/vveloso","followers_url":"https://api.github.com/users/vveloso/followers","following_url":"https://api.github.com/users/vveloso/following{/other_user}","gists_url":"https://api.github.com/users/vveloso/gists{/gist_id}","starred_url":"https://api.github.com/users/vveloso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vveloso/subscriptions","organizations_url":"https://api.github.com/users/vveloso/orgs","repos_url":"https://api.github.com/users/vveloso/repos","events_url":"https://api.github.com/users/vveloso/events{/privacy}","received_events_url":"https://api.github.com/users/vveloso/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/querydsl/querydsl/milestones/32","html_url":"https://github.com/querydsl/querydsl/milestones/4.0.4","labels_url":"https://api.github.com/repos/querydsl/querydsl/milestones/32/labels","id":1236399,"number":32,"title":"4.0.4","description":"","creator":{"login":"timowest","id":574167,"avatar_url":"https://avatars.githubusercontent.com/u/574167?v=3","gravatar_id":"","url":"https://api.github.com/users/timowest","html_url":"https://github.com/timowest","followers_url":"https://api.github.com/users/timowest/followers","following_url":"https://api.github.com/users/timowest/following{/other_user}","gists_url":"https://api.github.com/users/timowest/gists{/gist_id}","starred_url":"https://api.github.com/users/timowest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timowest/subscriptions","organizations_url":"https://api.github.com/users/timowest/orgs","repos_url":"https://api.github.com/users/timowest/repos","events_url":"https://api.github.com/users/timowest/events{/privacy}","received_events_url":"https://api.github.com/users/timowest/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":12,"state":"closed","created_at":"2015-08-01T20:26:38Z","updated_at":"2015-08-31T21:02:21Z","due_on":"2015-08-30T21:00:00Z","closed_at":"2015-08-31T21:00:47Z"},"comments":0,"created_at":"2015-07-28T14:05:44Z","updated_at":"2015-08-31T21:02:21Z","closed_at":"2015-08-31T21:02:21Z","body":"With QueryDSL 3.6.5, the following XML mappings generate public final fields that are not initialized in leaf types.\r\n\r\n```xml\r\n<hibernate-mapping default-access=\"field\" default-lazy=\"false\">\r\n <class abstract=\"true\"\r\n  name=\"ConnectionRouteDb\" table=\"DCN_NE_ROUTES\">\r\n  <composite-id access=\"field\" name=\"routeKey\" class=\"ConnectionRouteDbKey\">\r\n   <key-property name=\"type\" type=\"string\" column=\"ROUTE_TYPE\"/>\r\n   <key-property name=\"key\" type=\"string\" column=\"ROUTE_KEY\"/>\r\n  </composite-id>\r\n  <discriminator force=\"false\" insert=\"false\" not-null=\"true\">\r\n   <column name=\"ROUTE_TYPE\"/>\r\n  </discriminator>\r\n  <version access=\"field\" column=\"VERSION\" generated=\"never\"\r\n   name=\"version\" type=\"int\"/>\r\n  <property access=\"field\" generated=\"never\" lazy=\"false\" name=\"cost\" type=\"int\">\r\n   <column name=\"COST\"/>\r\n  </property>\r\n  <property access=\"field\" generated=\"never\" lazy=\"false\" name=\"neId\" type=\"int\">\r\n   <column name=\"NE_ID\"/>\r\n  </property>\r\n </class>\r\n</hibernate-mapping>\r\n```\r\n\r\n```xml\r\n<hibernate-mapping>\r\n <subclass discriminator-value=\"GATEWAY\"\r\n  extends=\"ConnectionRouteDb\" lazy=\"false\"\r\n  name=\"GatewayRouteDb\" select-before-update=\"false\">\r\n </subclass>\r\n</hibernate-mapping>\r\n```\r\nGenerates:\r\n```java\r\n@Generated(\"com.mysema.query.codegen.EntitySerializer\")\r\npublic class QNeConnectionRouteDb extends EntityPathBase<NeConnectionRouteDb<?, ?>> {\r\n\r\n    private static final long serialVersionUID = -2050193206L;\r\n\r\n    private static final PathInits INITS = PathInits.DIRECT2;\r\n\r\n    public static final QNeConnectionRouteDb neConnectionRouteDb = new QNeConnectionRouteDb(\"neConnectionRouteDb\");\r\n\r\n    public final com.ossnms.bicnet.emne.core.entities.ne.data.QNeConnectionRouteData_NeConnectionRoutePrototype _super = new com.ossnms.bicnet.emne.core.entities.ne.data.QNeConnectionRouteData_NeConnectionRoutePrototype(this);\r\n\r\n    public final NumberPath<Integer> cost = createNumber(\"cost\", Integer.class);\r\n\r\n    public final NumberPath<Integer> neId = createNumber(\"neId\", Integer.class);\r\n\r\n    public final QNeConnectionRouteDbKey routeKey;\r\n\r\n    public final NumberPath<Integer> version = createNumber(\"version\", Integer.class);\r\n\r\n    @SuppressWarnings(\"all\")\r\n    public QNeConnectionRouteDb(String variable) {\r\n        this((Class)NeConnectionRouteDb.class, forVariable(variable), INITS);\r\n    }\r\n\r\n    @SuppressWarnings(\"all\")\r\n    public QNeConnectionRouteDb(Path<? extends NeConnectionRouteDb> path) {\r\n        this((Class)path.getType(), path.getMetadata(), path.getMetadata().isRoot() ? INITS : PathInits.DEFAULT);\r\n    }\r\n\r\n    public QNeConnectionRouteDb(PathMetadata<?> metadata) {\r\n        this(metadata, metadata.isRoot() ? INITS : PathInits.DEFAULT);\r\n    }\r\n\r\n    @SuppressWarnings(\"all\")\r\n    public QNeConnectionRouteDb(PathMetadata<?> metadata, PathInits inits) {\r\n        this((Class)NeConnectionRouteDb.class, metadata, inits);\r\n    }\r\n\r\n    public QNeConnectionRouteDb(Class<? extends NeConnectionRouteDb<?, ?>> type, PathMetadata<?> metadata, PathInits inits) {\r\n        super(type, metadata, inits);\r\n        this.routeKey = inits.isInitialized(\"routeKey\") ? new QNeConnectionRouteDbKey(forProperty(\"routeKey\")) : null;\r\n    }\r\n\r\n}\r\n```\r\n\r\n```java\r\n@Generated(\"com.mysema.query.codegen.EntitySerializer\")\r\npublic class QNeGatewayRouteDb extends EntityPathBase<NeGatewayRouteDb> {\r\n\r\n    private static final long serialVersionUID = 169698434L;\r\n\r\n    public static final QNeGatewayRouteDb neGatewayRouteDb = new QNeGatewayRouteDb(\"neGatewayRouteDb\");\r\n\r\n    public final QNeConnectionRouteDb _super;\r\n\r\n    //inherited\r\n    public final NumberPath<Integer> cost;\r\n\r\n    //inherited\r\n    public final NumberPath<Integer> neId;\r\n\r\n    // custom\r\n    public final QNeConnectionRouteDbKey routeKey = new QNeConnectionRouteDbKey(forProperty(\"routeKey\"));\r\n\r\n    //inherited\r\n    public final NumberPath<Integer> version;\r\n\r\n    public QNeGatewayRouteDb(String variable) {\r\n        super(NeGatewayRouteDb.class, forVariable(variable));\r\n    }\r\n\r\n    public QNeGatewayRouteDb(Path<? extends NeGatewayRouteDb> path) {\r\n        super(path.getType(), path.getMetadata());\r\n    }\r\n\r\n    public QNeGatewayRouteDb(PathMetadata<?> metadata) {\r\n        super(NeGatewayRouteDb.class, metadata);\r\n    }\r\n\r\n}\r\n```\r\n\r\nWhich does not compile.\r\n\r\nThe same issue happens on 3.6.3. I did not test 3.6.4.\r\n\r\nIf the key is simple instead of composite, the code is generated correctly. Unfortunately I need to use composite keys."}}