我正在使用Struts,hibernate。该项目工作正常。现在,我使用依赖注入gor在服务层创建dao对象。它不起作用。请告诉我这里出了什么问题。
<!-- properties declares that the contained properties form an alternate key. The name
attribute allows an alternate key to be used as the target of a property-ref. -->
<!ELEMENT properties (
(property|many-to-one|component|dynamic-component)*
)>
<!ATTLIST properties name CDATA #REQUIRED>
<!ATTLIST properties unique (true|false) "false">
<!ATTLIST properties insert (true|false) "true">
<!ATTLIST properties update (true|false) "true">
<!ATTLIST properties optimistic-lock (true|false) "true">
<!ATTLIST properties node CDATA #IMPLIED>
<!-- The parent element maps a property of the component class as a pointer back to
the owning entity. -->
<!ELEMENT parent EMPTY>
<!ATTLIST parent name CDATA #REQUIRED>
<!-- Collection declarations nested inside a class declaration indicate a foreign key
relationship from the collection table to the enclosing class. -->
<!ELEMENT map (
meta*,
subselect?,
cache?,
synchronize*,
comment?,
key,
(map-key|composite-map-key|map-key-many-to-many|index|composite-index|index-many-to-many|index-many-to-any),
(element|one-to-many|many-to-many|composite-element|many-to-any),
loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,
filter*
)>
<!ATTLIST map name CDATA #REQUIRED>
<!ATTLIST map access CDATA #IMPLIED>
<!ATTLIST map table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST map schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST map subselect CDATA #IMPLIED>
<!ATTLIST map catalog CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST map lazy (true|false|extra) #IMPLIED>
<!ATTLIST map mutable (true|false) "true">
<!ATTLIST map inverse (true|false) "false">
<!ATTLIST map sort CDATA "unsorted"> <!-- unsorted|natural|"comparator class", default: unsorted -->
<!ATTLIST map cascade CDATA #IMPLIED>
<!ATTLIST map order-by CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST map where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST map batch-size CDATA #IMPLIED>
<!ATTLIST map outer-join (true|false|auto) #IMPLIED>
<!ATTLIST map fetch (join|select|subselect) #IMPLIED>
<!ATTLIST map check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST map persister CDATA #IMPLIED>
<!ATTLIST map collection-type CDATA #IMPLIED>
<!ATTLIST map optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST map node CDATA #IMPLIED>
<!ATTLIST map embed-xml (true|false) "true">
<!ELEMENT set (
meta*,
subselect?,
cache?,
synchronize*,
comment?,
key,
(element|one-to-many|many-to-many|composite-element|many-to-any),
loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,
filter*
)>
<!ATTLIST set name CDATA #REQUIRED>
<!ATTLIST set access CDATA #IMPLIED>
<!ATTLIST set table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST set schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST set catalog CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST set subselect CDATA #IMPLIED>
<!ATTLIST set lazy (true|false|extra) #IMPLIED>
<!ATTLIST set sort CDATA "unsorted"> <!-- unsorted|natural|"comparator class" -->
<!ATTLIST set inverse (true|false) "false">
<!ATTLIST set mutable (true|false) "true">
<!ATTLIST set cascade CDATA #IMPLIED>
<!ATTLIST set order-by CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST set where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST set batch-size CDATA #IMPLIED>
<!ATTLIST set outer-join (true|false|auto) #IMPLIED>
<!ATTLIST set fetch (join|select|subselect) #IMPLIED>
<!ATTLIST set persister CDATA #IMPLIED>
<!ATTLIST set collection-type CDATA #IMPLIED>
<!ATTLIST set check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST set optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST set node CDATA #IMPLIED>
<!ATTLIST set embed-xml (true|false) "true">
<!ELEMENT bag (
meta*,
subselect?,
cache?,
synchronize*,
comment?,
key,
(element|one-to-many|many-to-many|composite-element|many-to-any),
loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,
filter*
)>
<!ATTLIST bag name CDATA #REQUIRED>
<!ATTLIST bag access CDATA #IMPLIED>
<!ATTLIST bag table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST bag schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST bag catalog CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST bag subselect CDATA #IMPLIED>
<!ATTLIST bag lazy (true|false|extra) #IMPLIED>
<!ATTLIST bag inverse (true|false) "false">
<!ATTLIST bag mutable (true|false) "true">
<!ATTLIST bag cascade CDATA #IMPLIED>
<!ATTLIST bag order-by CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST bag where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST bag batch-size CDATA #IMPLIED>
<!ATTLIST bag outer-join (true|false|auto) #IMPLIED>
<!ATTLIST bag fetch (join|select|subselect) #IMPLIED>
<!ATTLIST bag persister CDATA #IMPLIED>
<!ATTLIST bag collection-type CDATA #IMPLIED>
<!ATTLIST bag check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST bag optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST bag node CDATA #IMPLIED>
<!ATTLIST bag embed-xml (true|false) "true">
<!ELEMENT idbag (
meta*,
subselect?,
cache?,
synchronize*,
comment?,
collection-id,
key,
(element|many-to-many|composite-element|many-to-any),
loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,
filter*
)>
<!ATTLIST idbag name CDATA #REQUIRED>
<!ATTLIST idbag access CDATA #IMPLIED>
<!ATTLIST idbag table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST idbag schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag catalog CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag subselect CDATA #IMPLIED>
<!ATTLIST idbag lazy (true|false|extra) #IMPLIED>
<!ATTLIST idbag mutable (true|false) "true">
<!ATTLIST idbag cascade CDATA #IMPLIED>
<!ATTLIST idbag order-by CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag batch-size CDATA #IMPLIED>
<!ATTLIST idbag outer-join (true|false|auto) #IMPLIED>
<!ATTLIST idbag fetch (join|select|subselect) #IMPLIED>
<!ATTLIST idbag persister CDATA #IMPLIED>
<!ATTLIST idbag collection-type CDATA #IMPLIED>
<!ATTLIST idbag check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST idbag node CDATA #IMPLIED>
<!ATTLIST idbag embed-xml (true|false) "true">
<!ELEMENT list (
meta*,
subselect?,
cache?,
synchronize*,
comment?,
key,
(index|list-index),
(element|one-to-many|many-to-many|composite-element|many-to-any),
loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,
filter*
)>
<!ATTLIST list name CDATA #REQUIRED>
<!ATTLIST list access CDATA #IMPLIED>
<!ATTLIST list table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST list schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST list catalog CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST list subselect CDATA #IMPLIED>
<!ATTLIST list lazy (true|false|extra) #IMPLIED>
<!ATTLIST list inverse (true|false) "false">
<!ATTLIST list mutable (true|false) "true">
<!ATTLIST list cascade CDATA #IMPLIED>
<!ATTLIST list where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST list batch-size CDATA #IMPLIED>
<!ATTLIST list outer-join (true|false|auto) #IMPLIED>
<!ATTLIST list fetch (join|select|subselect) #IMPLIED>
<!ATTLIST list persister CDATA #IMPLIED>
<!ATTLIST list collection-type CDATA #IMPLIED>
<!ATTLIST list check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST list optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST list node CDATA #IMPLIED>
<!ATTLIST list embed-xml (true|false) "true">
<!ELEMENT array (
meta*,
subselect?,
cache?,
synchronize*,
comment?,
key,
(index|list-index),
(element|one-to-many|many-to-many|composite-element|many-to-any),
loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?
)>
<!ATTLIST array name CDATA #REQUIRED>
<!ATTLIST array access CDATA #IMPLIED>
<!ATTLIST array table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST array schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST array catalog CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST array subselect CDATA #IMPLIED>
<!ATTLIST array inverse (true|false) "false">
<!ATTLIST array mutable (true|false) "true">
<!ATTLIST array element-class CDATA #IMPLIED>
<!ATTLIST array cascade CDATA #IMPLIED>
<!ATTLIST array where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST array batch-size CDATA #IMPLIED>
<!ATTLIST array outer-join (true|false|auto) #IMPLIED>
<!ATTLIST array fetch (join|select|subselect) #IMPLIED>
<!ATTLIST array persister CDATA #IMPLIED>
<!ATTLIST array collection-type CDATA #IMPLIED>
<!ATTLIST array check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST array optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST array node CDATA #IMPLIED>
<!ATTLIST array embed-xml (true|false) "true">
<!ELEMENT primitive-array (
meta*,
subselect?,
cache?,
synchronize*,
comment?,
key,
(index|list-index),
element,
loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?
)>
<!ATTLIST primitive-array name CDATA #REQUIRED>
<!ATTLIST primitive-array access CDATA #IMPLIED>
<!ATTLIST primitive-array table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST primitive-array schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST primitive-array catalog CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST primitive-array subselect CDATA #IMPLIED>
<!ATTLIST primitive-array mutable (true|false) "true">
<!ATTLIST primitive-array where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST primitive-array batch-size CDATA #IMPLIED>
<!ATTLIST primitive-array outer-join (true|false|auto) #IMPLIED>
<!ATTLIST primitive-array fetch (join|select|subselect) #IMPLIED>
<!ATTLIST primitive-array persister CDATA #IMPLIED>
<!ATTLIST primitive-array collection-type CDATA #IMPLIED>
<!ATTLIST primitive-array check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST primitive-array optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST primitive-array node CDATA #IMPLIED>
<!ATTLIST primitive-array embed-xml (true|false) "true">
<!-- Declares the element type of a collection of basic type -->
<!ELEMENT element ( (column|formula)*, type? )>
<!ATTLIST element column CDATA #IMPLIED>
<!ATTLIST element node CDATA #IMPLIED>
<!ATTLIST element formula CDATA #IMPLIED>
<!ATTLIST element type CDATA #IMPLIED>
<!ATTLIST element length CDATA #IMPLIED>
<!ATTLIST element precision CDATA #IMPLIED>
<!ATTLIST element scale CDATA #IMPLIED>
<!ATTLIST element not-null (true|false) "false">
<!ATTLIST element unique (true|false) "false">
<!-- One to many association. This tag declares the entity-class
element type of a collection and specifies a one-to-many relational model -->
<!ELEMENT one-to-many EMPTY>
<!ATTLIST one-to-many class CDATA #IMPLIED>
<!ATTLIST one-to-many not-found (exception|ignore) "exception">
<!ATTLIST one-to-many node CDATA #IMPLIED>
<!ATTLIST one-to-many embed-xml (true|false) "true">
<!ATTLIST one-to-many entity-name CDATA #IMPLIED>
<!-- No column declaration attributes required in this case. The primary
key column of the associated class is already mapped elsewhere.-->
<!-- Many to many association. This tag declares the entity-class
element type of a collection and specifies a many-to-many relational model -->
<!ELEMENT many-to-many (meta*,(column|formula)*,filter*)>
<!ATTLIST many-to-many class CDATA #IMPLIED>
<!ATTLIST many-to-many node CDATA #IMPLIED>
<!ATTLIST many-to-many embed-xml (true|false) "true">
<!ATTLIST many-to-many entity-name CDATA #IMPLIED>
<!ATTLIST many-to-many column CDATA #IMPLIED>
<!ATTLIST many-to-many formula CDATA #IMPLIED>
<!ATTLIST many-to-many not-found (exception|ignore) "exception">
<!ATTLIST many-to-many outer-join (true|false|auto) #IMPLIED>
<!ATTLIST many-to-many fetch (join|select) #IMPLIED>
<!ATTLIST many-to-many lazy (false|proxy) #IMPLIED>
<!ATTLIST many-to-many foreign-key CDATA #IMPLIED>
<!ATTLIST many-to-many unique (true|false) "false">
<!ATTLIST many-to-many where CDATA #IMPLIED>
<!ATTLIST many-to-many order-by CDATA #IMPLIED>
<!ATTLIST many-to-many property-ref CDATA #IMPLIED>
<!-- A composite element allows a collection to hold instances of an arbitrary
class, without the requirement of joining to an entity table. Composite elements
have component semantics - no shared references and ad hoc null value semantics.
Composite elements may not hold nested collections. -->
<!ELEMENT composite-element (
(meta*),
parent?,
tuplizer*,
(property|many-to-one|any|nested-composite-element)*
)>
<!ATTLIST composite-element class CDATA #REQUIRED>
<!ATTLIST composite-element node CDATA #IMPLIED>
<!ELEMENT nested-composite-element (
parent?,
tuplizer*,
(property|many-to-one|any|nested-composite-element)*
)>
<!ATTLIST nested-composite-element class CDATA #REQUIRED>
<!ATTLIST nested-composite-element name CDATA #REQUIRED>
<!ATTLIST nested-composite-element access CDATA #IMPLIED>
<!ATTLIST nested-composite-element node CDATA #IMPLIED>
<!-- Declares the column name of a foreign key. -->
<!ELEMENT key (column*)>
<!ATTLIST key column CDATA #IMPLIED>
<!ATTLIST key property-ref CDATA #IMPLIED>
<!ATTLIST key foreign-key CDATA #IMPLIED>
<!ATTLIST key on-delete (cascade|noaction) "noaction">
<!ATTLIST key not-null (true|false) #IMPLIED>
<!ATTLIST key update (true|false) #IMPLIED>
<!ATTLIST key unique (true|false) #IMPLIED>
<!-- Declares the type and column mapping for a collection index (array or
list index, or key of a map). -->
<!ELEMENT list-index (column?)>
<!ATTLIST list-index column CDATA #IMPLIED>
<!ATTLIST list-index base CDATA "0">
<!ELEMENT map-key ((column|formula)*,type?)>
<!ATTLIST map-key column CDATA #IMPLIED>
<!ATTLIST map-key formula CDATA #IMPLIED>
<!ATTLIST map-key type CDATA #IMPLIED>
<!ATTLIST map-key length CDATA #IMPLIED>
<!ATTLIST map-key node CDATA #IMPLIED>
<!ELEMENT index (column*)>
<!ATTLIST index column CDATA #IMPLIED>
<!ATTLIST index type CDATA #IMPLIED> <!-- required for maps -->
<!ATTLIST index length CDATA #IMPLIED>
<!-- Many to many association mapped to the key of a map. ie. a map keyed
on entities. -->
<!ELEMENT map-key-many-to-many ((column|formula)*)>
<!ATTLIST map-key-many-to-many class CDATA #IMPLIED>
<!ATTLIST map-key-many-to-many entity-name CDATA #IMPLIED>
<!ATTLIST map-key-many-to-many column CDATA #IMPLIED>
<!ATTLIST map-key-many-to-many formula CDATA #IMPLIED>
<!ATTLIST map-key-many-to-many foreign-key CDATA #IMPLIED>
<!ELEMENT index-many-to-many (column*)>
<!ATTLIST index-many-to-many class CDATA #REQUIRED>
<!ATTLIST index-many-to-many entity-name CDATA #IMPLIED>
<!ATTLIST index-many-to-many column CDATA #IMPLIED>
<!ATTLIST index-many-to-many foreign-key CDATA #IMPLIED>
<!-- Composite index of a map ie. a map keyed on components. -->
<!ELEMENT composite-map-key ( (key-property|key-many-to-one)+ )>
<!ATTLIST composite-map-key class CDATA #REQUIRED>
<!ELEMENT composite-index ( (key-property|key-many-to-one)+ )>
<!ATTLIST composite-index class CDATA #REQUIRED>
<!-- A "many to any" defines a polymorphic association to any table
with the given identifier type. The first listed column is a VARCHAR column
holding the name of the class (for that row). -->
<!ELEMENT many-to-any (meta-value*,column, column+)>
<!ATTLIST many-to-any id-type CDATA #REQUIRED>
<!ATTLIST many-to-any meta-type CDATA #IMPLIED> <!--- default: Hibernate.CLASS -->
<!ELEMENT index-many-to-any (column, column+)>
<!ATTLIST index-many-to-any id-type CDATA #REQUIRED>
<!ATTLIST index-many-to-any meta-type CDATA #IMPLIED> <!--- default: Hibernate.CLASS -->
<!ELEMENT collection-id (meta*, column*, generator)>
<!ATTLIST collection-id column CDATA #REQUIRED>
<!ATTLIST collection-id type CDATA #REQUIRED>
<!ATTLIST collection-id length CDATA #IMPLIED>
<!-- Generators generate unique identifiers. The class attribute specifies a Java
class implementing an id generation algorithm. -->
<!ELEMENT generator (param*)>
<!ATTLIST generator class CDATA #REQUIRED>
<!ELEMENT param (#PCDATA)>
<!ATTLIST param name CDATA #REQUIRED>
<!-- The column element is an alternative to column attributes and required for
mapping associations to classes with composite ids. -->
<!ELEMENT column (comment?)>
<!ATTLIST column name CDATA #REQUIRED>
<!ATTLIST column length CDATA #IMPLIED> <!-- default: 255 -->
<!ATTLIST column precision CDATA #IMPLIED>
<!ATTLIST column scale CDATA #IMPLIED>
<!ATTLIST column not-null (true|false) #IMPLIED> <!-- default: false (except for id properties) -->
<!ATTLIST column unique (true|false) #IMPLIED> <!-- default: false (except for id properties) -->
<!ATTLIST column unique-key CDATA #IMPLIED> <!-- default: no unique key -->
<!ATTLIST column sql-type CDATA #IMPLIED> <!-- override default column type for hibernate type -->
<!ATTLIST column index CDATA #IMPLIED>
<!ATTLIST column check CDATA #IMPLIED> <!-- default: no check constraint -->
<!ATTLIST column default CDATA #IMPLIED> <!-- default: no default value -->
<!ATTLIST column read CDATA #IMPLIED> <!-- default: column name -->
<!ATTLIST column write CDATA #IMPLIED> <!-- default: parameter placeholder ('?') -->
<!-- The formula and subselect elements allow us to map derived properties and
entities. -->
<!ELEMENT formula (#PCDATA)>
<!ELEMENT subselect (#PCDATA)>
<!-- The cache element enables caching of an entity class. -->
<!ELEMENT cache EMPTY>
<!ATTLIST cache usage (read-only|read-write|nonstrict-read-write|transactional) #REQUIRED>
<!ATTLIST cache region CDATA #IMPLIED> <!-- default: class or collection role name -->
<!ATTLIST cache include (all|non-lazy) "all">
<!-- The comment element allows definition of a database table or column comment. -->
<!ELEMENT comment (#PCDATA)>
<!-- The loader element allows specification of a named query to be used for fetching
an entity or collection -->
<!ELEMENT loader EMPTY>
<!ATTLIST loader query-ref CDATA #REQUIRED>
<!-- The query element declares a named Hibernate query string -->
<!ELEMENT query (#PCDATA|query-param)*>
<!ATTLIST query name CDATA #REQUIRED>
<!ATTLIST query flush-mode (auto|never|always) #IMPLIED>
<!ATTLIST query cacheable (true|false) "false">
<!ATTLIST query cache-region CDATA #IMPLIED>
<!ATTLIST query fetch-size CDATA #IMPLIED>
<!ATTLIST query timeout CDATA #IMPLIED>
<!ATTLIST query cache-mode (get|ignore|normal|put|refresh) #IMPLIED>
<!ATTLIST query read-only (true|false) #IMPLIED>
<!ATTLIST query comment CDATA #IMPLIED>
<!-- The sql-query element declares a named SQL query string -->
<!ELEMENT sql-query (#PCDATA|return-scalar|return|return-join|load-collection|synchronize|query-param)*>
<!ATTLIST sql-query name CDATA #REQUIRED>
<!ATTLIST sql-query resultset-ref CDATA #IMPLIED>
<!ATTLIST sql-query flush-mode (auto|never|always) #IMPLIED>
<!ATTLIST sql-query cacheable (true|false) "false">
<!ATTLIST sql-query cache-region CDATA #IMPLIED>
<!ATTLIST sql-query fetch-size CDATA #IMPLIED>
<!ATTLIST sql-query timeout CDATA #IMPLIED>
<!ATTLIST sql-query cache-mode (get|ignore|normal|put|refresh) #IMPLIED>
<!ATTLIST sql-query read-only (true|false) #IMPLIED>
<!ATTLIST sql-query comment CDATA #IMPLIED>
<!ATTLIST sql-query callable (true|false) "false">
<!-- The query-param element is used only by tools that generate
finder methods for named queries -->
<!ELEMENT query-param EMPTY>
<!ATTLIST query-param name CDATA #REQUIRED>
<!ATTLIST query-param type CDATA #REQUIRED>
<!-- The resultset element declares a named resultset mapping definition for SQL queries -->
<!ELEMENT resultset (return-scalar|return|return-join|load-collection)*>
<!ATTLIST resultset name CDATA #REQUIRED>
<!--
Defines a return component for a sql-query. Alias refers to the alias
used in the actual sql query; lock-mode specifies the locking to be applied
when the query is executed. The class, collection, and role attributes are mutually exclusive;
class refers to the class name of a "root entity" in the object result; collection refers
to a collection of a given class and is used to define custom sql to load that owned collection
and takes the form "ClassName.propertyName"; role refers to the property path for an eager fetch
and takes the form "owningAlias.propertyName"
-->
<!ELEMENT return (return-discriminator?,return-property)*>
<!ATTLIST return alias CDATA #IMPLIED>
<!ATTLIST return entity-name CDATA #IMPLIED>
<!ATTLIST return class CDATA #IMPLIED>
<!ATTLIST return lock-mode (none|read|upgrade|upgrade-nowait|write) "read">
<!ELEMENT return-property (return-column*)>
<!ATTLIST return-property name CDATA #REQUIRED>
<!ATTLIST return-property column CDATA #IMPLIED>
<!ELEMENT return-column EMPTY>
<!ATTLIST return-column name CDATA #REQUIRED>
<!ELEMENT return-discriminator EMPTY>
<!ATTLIST return-discriminator column CDATA #REQUIRED>
<!ELEMENT return-join (return-property)*>
<!ATTLIST return-join alias CDATA #REQUIRED>
<!ATTLIST return-join property CDATA #REQUIRED>
<!ATTLIST return-join lock-mode (none|read|upgrade|upgrade-nowait|write) "read">
<!ELEMENT load-collection (return-property)*>
<!ATTLIST load-collection alias CDATA #REQUIRED>
<!ATTLIST load-collection role CDATA #REQUIRED>
<!ATTLIST load-collection lock-mode (none|read|upgrade|upgrade-nowait|write) "read">
<!ELEMENT return-scalar EMPTY>
<!ATTLIST return-scalar column CDATA #REQUIRED>
<!ATTLIST return-scalar type CDATA #IMPLIED>
<!ELEMENT synchronize EMPTY>
<!ATTLIST synchronize table CDATA #REQUIRED>
<!-- custom sql operations -->
<!ELEMENT sql-insert (#PCDATA)>
<!ATTLIST sql-insert callable (true|false) "false">
<!ATTLIST sql-insert check (none|rowcount|param) #IMPLIED>
<!ELEMENT sql-update (#PCDATA)>
<!ATTLIST sql-update callable (true|false) "false">
<!ATTLIST sql-update check (none|rowcount|param) #IMPLIED>
<!ELEMENT sql-delete (#PCDATA)>
<!ATTLIST sql-delete callable (true|false) "false">
<!ATTLIST sql-delete check (none|rowcount|param) #IMPLIED>
<!ELEMENT sql-delete-all (#PCDATA)>
<!ATTLIST sql-delete-all callable (true|false) "false">
<!ATTLIST sql-delete-all check (none|rowcount|param) #IMPLIED>
<!--
Element for defining "auxiliary" database objects. Must be one of two forms:
#1 :
<database-object>
<definition class="CustomClassExtendingAuxiliaryObject"/>
</database-object>
#2 :
<database-object>
<create>CREATE OR REPLACE ....</create>
<drop>DROP ....</drop>
</database-object>
-->
<!ELEMENT database-object ( (definition|(create,drop)), dialect-scope* )>
<!ELEMENT definition EMPTY>
<!ATTLIST definition class CDATA #REQUIRED>
<!ELEMENT create (#PCDATA)>
<!ELEMENT drop (#PCDATA)>
<!--
dialect-scope element allows scoping auxiliary-objects to a particular
Hibernate dialect implementation.
-->
<!ELEMENT dialect-scope (#PCDATA)>
<!ATTLIST dialect-scope name CDATA #REQUIRED>
我正在使用Struts,hibernate。该项目工作正常。现在,我使用依赖注入gor在服务层创建dao对象。它不起作用。请告诉我这里出了什么问题。
答案 0 :(得分:0)
您需要通过在web.xml中启用ContextLoaderListener来启动Spring容器:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
答案 1 :(得分:0)
在web.xml中添加以下侦听器
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
在LeaveService.java中,添加以下构造函数:Spring为LeaveService创建bean时,它将调用下面的构造函数并将为字段leaveDAO设置值
LeaveService(LeaveDAO leaveDAO ){
this.leaveDAO = leaveDAO ;
}