嗨,我遵循了一些教程并编写了一个如下模式:
<xs:element name="User" type="kmcs:User"/>
<xs:element name="UserList" type="kmcs:UserList"/>
<xs:complexType name="User">
<xs:sequence>
<xs:element name="id" type="xs:long" minOccurs="0" />
<xs:element name="name" type="xs:string" />
<xs:element name="registrationDate" type="xs:dateTime" />
</xs:sequence>
<xs:attribute name = ""/>
</xs:complexType>
<xs:complexType name="UserList">
<xs:complexContent>
<xs:extension base="kmcs:User">
<xs:sequence>
<xs:element name="user" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
它生成以下内容:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "User", propOrder = {
"id",
"name",
"registrationDate"
})
@XmlSeeAlso({
UserList.class
})
@Entity
@XmlRootElement(name = "{@id}")
@Table(schema = "schemaname", uniqueConstraints = {
}, name = "BillingAccountNumberDetailsInfo")
public class User
implements Serializable, ToString
{
我想要这样的东西:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "User", propOrder = {
"id",
"name",
"registrationDate"
})
@XmlSeeAlso({
UserList.class
})
@Entity
@XmlRootElement(name ="user")
@Table(schema = "schema_name", uniqueConstraints = {
}, name = "User")
public class User
implements Serializable, ToString
{
所以我想要的基本上是表名,它选择我提供的硬编码但我希望它显示类名或类对象名。