Generate from Hibernate .hbm.xml does not include primary key
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Querydsl |
Fix Released
|
High
|
Unassigned |
Bug Description
I have an model class as following:
public class Store implements Serializable {
private static final long serialVersionUID = 722173073239200
private String code;
private String name;
private String address;
private String city;
private String phoneDetails;
private String faxDetails;
private String zipCode;
private String chainCode;
private Area area;
private State state;
private Status status = Status.ACTIVE;
// Getters and setters are omitted
}
And here is the mapping file for it:
<class name="xxx.
<cache usage="
<id name="code" type="java.
</id>
<property name="name">
<column name="NAME"/>
</property>
<property name="address">
<column name="ADDRESS"/>
</property>
<property name="city">
<column name="CITY"/>
</property>
<property name="phoneDeta
<column name="PHONE_
</property>
<property name="faxDetails">
<column name="FAX_DETAILS" length="30"/>
</property>
<property name="zipCode">
<column name="ZIP_CODE" length="15"/>
</property>
<property name="chainCode">
<column name="CHAIN_CODE"/>
</property>
</class>
But the QStore object does not contain the 'code' property (which is the primary key of the Store).
I put the QStore code here for completeness.
import static com.mysema.
import com.mysema.
import com.mysema.
/**
* QStore is a Querydsl query type for Store
*/
public class QStore extends EntityPathBase<
private static final long serialVersionUID = -1753548466;
private static final PathInits INITS = PathInits.DIRECT;
public static final QStore store = new QStore("store");
public final StringPath address = createString(
public final QArea area;
public final StringPath chainCode = createString(
public final StringPath city = createString(
public final StringPath faxDetails = createString(
public final StringPath name = createString(
public final StringPath phoneDetails = createString(
public final QState state;
public final StringPath zipCode = createString(
public QStore(String variable) {
}
public QStore(
}
public QStore(
}
public QStore(Class<? extends Store> type, PathMetadata<?> metadata, PathInits inits) {
super(type, metadata, inits);
this.area = inits.isInitial
this.state = inits.isInitial
}
}
Here is the code to generate Query Object:
public static void main(String[] args) {
System.
System.
String projectDir = System.
System.
String configDir = File.separator + projectDir + File.separator
+ "src" + File.separator + "main" + File.separator + "webapp"
+ File.separator + "WEB-INF" + File.separator;
System.
String genDir = projectDir + File.separator + "src" + File.separator
+ "main" + File.separator + "java" + File.separator;
System.
FileSystemXml
configDir + "applicationCon
+ "dataSource.xml", configDir + "core.xml");
LocalSessionF
.getBean(
Configuration configuration = sfFactoryBean.
HibernateDoma
"Q", new File(genDir), configuration);
try {
domainExport
System.
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStack
}
}
Changed in querydsl: | |
importance: | Undecided → High |
status: | New → In Progress |
Changed in querydsl: | |
status: | In Progress → Fix Committed |
Thanks for the bug report. I fixed the identifier handling.