From: <fg...@us...> - 2009-09-05 19:14:23
|
Revision: 1428 http://openutils.svn.sourceforge.net/openutils/?rev=1428&view=rev Author: fgiust Date: 2009-09-05 19:14:16 +0000 (Sat, 05 Sep 2009) Log Message: ----------- cleaned up Modified Paths: -------------- trunk/openutils-bshd5/pom.xml Added Paths: ----------- trunk/openutils-bshd5/src/main/assembly/ trunk/openutils-bshd5/src/main/assembly/assembly-bundle.xml trunk/openutils-bshd5/src/main/bundle/ trunk/openutils-bshd5/src/main/bundle/LICENSE.txt trunk/openutils-bshd5/src/main/bundle/README.txt Modified: trunk/openutils-bshd5/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2009-09-05 19:07:37 UTC (rev 1427) +++ trunk/openutils-bshd5/pom.xml 2009-09-05 19:14:16 UTC (rev 1428) @@ -9,7 +9,39 @@ <artifactId>openutils-bshd5</artifactId> <name>openutils base Spring-Hibernate DAO for java 5.0</name> <version>2.0.6-SNAPSHOT</version> - <description>openutils base Spring-Hibernate DAO for java 5.0</description> + <description>Openutils base Spring-Hibernate DAO for java 5.0</description> + <licenses> + <license> + <name>The Apache Software License, Version 2.0</name> + <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> + </license> + </licenses> + <url>http://lab.openmindonline.it/lab/products/bshd5.html</url> + <issueManagement> + <system>jira</system> + <url>http://lab.openmindonline.it/jira/browse/BSHD</url> + </issueManagement> + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>bundle</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + <configuration> + <descriptors> + <descriptor>${basedir}/src/main/assembly/assembly-bundle.xml</descriptor> + </descriptors> + </configuration> + </plugin> + </plugins> + </build> <dependencies> <dependency> <groupId>org.slf4j</groupId> Added: trunk/openutils-bshd5/src/main/assembly/assembly-bundle.xml =================================================================== --- trunk/openutils-bshd5/src/main/assembly/assembly-bundle.xml (rev 0) +++ trunk/openutils-bshd5/src/main/assembly/assembly-bundle.xml 2009-09-05 19:14:16 UTC (rev 1428) @@ -0,0 +1,33 @@ +<assembly> + <id>bundle</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <fileSets> + <fileSet> + <filtered>true</filtered> + <outputDirectory>/</outputDirectory> + <lineEnding>crlf</lineEnding> + <directory>${basedir}/src/main/bundle</directory> + <includes> + <include>*</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/java/</directory> + <outputDirectory>/sources/</outputDirectory> + <includes> + <include>**/*</include> + </includes> + </fileSet> + </fileSets> + <dependencySets> + <dependencySet> + <outputDirectory>bin</outputDirectory> + <includes> + <include>net.sourceforge.openutils:*</include> + </includes> + </dependencySet> + </dependencySets> +</assembly> \ No newline at end of file Property changes on: trunk/openutils-bshd5/src/main/assembly/assembly-bundle.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/main/bundle/LICENSE.txt =================================================================== --- trunk/openutils-bshd5/src/main/bundle/LICENSE.txt (rev 0) +++ trunk/openutils-bshd5/src/main/bundle/LICENSE.txt 2009-09-05 19:14:16 UTC (rev 1428) @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. Property changes on: trunk/openutils-bshd5/src/main/bundle/LICENSE.txt ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/main/bundle/README.txt =================================================================== --- trunk/openutils-bshd5/src/main/bundle/README.txt (rev 0) +++ trunk/openutils-bshd5/src/main/bundle/README.txt 2009-09-05 19:14:16 UTC (rev 1428) @@ -0,0 +1,53 @@ +=========================================================== + +${pom.name} ${pom.version} +by ${pom.organization.name} + +=========================================================== + +${pom.description} + +More information about this project can be found at: +${pom.url} + +Change log and known issues can be found at: +${pom.issueManagement.url} + +Source is available from the subversion repository at: +${pom.scm.url} + +========================================= + USAGE +========================================= + +The preferred way to add ${pom.name} to your project is using maven. +You can declare the following dependency in your pom.xml: + + <dependency> + <groupId>${pom.groupId}</groupId> + <artifactId>${pom.artifactId}</artifactId> + <version>${pom.version}</version> + </dependency> + +Alternatively, you can add the ${pom.artifactId} plus the required dependencies +manually to the classpath of your application. + + +========================================= + LICENSE +========================================= + +Copyright Openmind http://www.openmindonline.it + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + Property changes on: trunk/openutils-bshd5/src/main/bundle/README.txt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gca...@us...> - 2010-05-09 17:10:32
|
Revision: 2373 http://openutils.svn.sourceforge.net/openutils/?rev=2373&view=rev Author: gcatania Date: 2010-05-09 17:10:25 +0000 (Sun, 09 May 2010) Log Message: ----------- adding barebone hsqldb test environment, some entities for BSHD-7 Modified Paths: -------------- trunk/openutils-bshd5/pom.xml Added Paths: ----------- trunk/openutils-bshd5/src/test/java/it/ trunk/openutils-bshd5/src/test/java/it/openutils/ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/HibernateDAOTest.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/dao/ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/dao/PersonDAO.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Address.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Chance.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FantasticThing.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FullName.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Person.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Title.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Wish.java trunk/openutils-bshd5/src/test/resources/ trunk/openutils-bshd5/src/test/resources/hibernate.cfg.xml trunk/openutils-bshd5/src/test/resources/spring-tests.xml Modified: trunk/openutils-bshd5/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2010-05-09 16:53:04 UTC (rev 2372) +++ trunk/openutils-bshd5/pom.xml 2010-05-09 17:10:25 UTC (rev 2373) @@ -137,8 +137,68 @@ <artifactId>javassist</artifactId> <version>3.4.GA</version> </dependency> + <!-- test dependencies --> + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>commons-dbcp</groupId> + <artifactId>commons-dbcp</artifactId> + <version>1.2.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${spring.version}</version> + <scope>test</scope> + </dependency> + <!-- + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aspects</artifactId> + <version>${spring.version}</version> + <scope>test</scope> + </dependency> + --> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>5.7</version> + <classifier>jdk15</classifier> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-annotations</artifactId> + <version>3.4.0.GA</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + </exclusion> + <exclusion> + <groupId>avalon-framework</groupId> + <artifactId>avalon-framework</artifactId> + </exclusion> + <exclusion> + <groupId>logkit</groupId> + <artifactId>logkit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <version>1.8.0.1</version> + <scope>test</scope> + </dependency> </dependencies> <properties> <spring.version>3.0.0.RELEASE</spring.version> </properties> -</project> \ No newline at end of file +</project> Added: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/HibernateDAOTest.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/HibernateDAOTest.java (rev 0) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/HibernateDAOTest.java 2010-05-09 17:10:25 UTC (rev 2373) @@ -0,0 +1,96 @@ +/** + * + * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * + * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * You may obtain a copy of the License at + * + * http://www.gnu.org/licenses/lgpl-2.1.html + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package it.openutils.hibernate.test; + +import it.openutils.hibernate.test.dao.PersonDAO; +import it.openutils.hibernate.test.model.Address; +import it.openutils.hibernate.test.model.FullName; +import it.openutils.hibernate.test.model.Person; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.testng.Assert; +import org.testng.annotations.Test; + + +/** + * @author gcatania + */ +@ContextConfiguration(locations = "/spring-tests.xml") +public class HibernateDAOTest extends AbstractTestNGSpringContextTests +{ + + @Autowired + private PersonDAO personDAO; + + private Person fifteenYearsOld() + { + return new Person( + new FullName("Troy", "Jones"), + 15, + new Address("Long road", 15, "Smalltown", "MI", 14352), + null); + } + + /** + * basic save/evict/get test. + */ + @Test + public void testSaveAndRetrievePerson() + { + Person person = fifteenYearsOld(); + Long savedId = personDAO.save(person); + Assert.assertNotNull(savedId); + Long personId = person.getId(); + Assert.assertEquals(savedId, personId); + personDAO.evict(person); + Person savedPerson = personDAO.get(personId); + Assert.assertEquals(person, savedPerson); + } + + /** + * fails because of BSHD-5 + */ + @Test(enabled = false) + public void testFindFilteredFirst() + { + personDAO.save(fifteenYearsOld()); + List<Person> found = personDAO.findFiltered(new Person(new FullName(null, "Jones"), null, null, null)); + Assert.assertNotNull(found); + if (found.size() == 0) + { + Assert.fail("No persons found"); + } + for (Person p : found) + { + System.out.println(p.toString()); + } + } + +} Property changes on: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/HibernateDAOTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/dao/PersonDAO.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/dao/PersonDAO.java (rev 0) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/dao/PersonDAO.java 2010-05-09 17:10:25 UTC (rev 2373) @@ -0,0 +1,36 @@ +/** + * + */ +package it.openutils.hibernate.test.dao; + +import it.openutils.dao.hibernate.HibernateDAO; +import it.openutils.dao.hibernate.HibernateDAOImpl; +import it.openutils.hibernate.test.model.Person; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + + +/** + * @author gcatania + */ +public interface PersonDAO extends HibernateDAO<Person, Long> +{ + + /** + * @author gcatania + */ + @Repository("personDAO") + class PersonDAOImpl extends HibernateDAOImpl<Person, Long> implements PersonDAO + { + + @Autowired + public PersonDAOImpl(SessionFactory factory) + { + super(Person.class); + setSessionFactory(factory); + } + } + +} Property changes on: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/dao/PersonDAO.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Address.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Address.java (rev 0) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Address.java 2010-05-09 17:10:25 UTC (rev 2373) @@ -0,0 +1,274 @@ +/** + * + */ +package it.openutils.hibernate.test.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + + +/** + * @author gcatania + */ +@Entity +public class Address +{ + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + @Column(nullable = false, length = 50) + private String street; + + @Column(nullable = false, scale = 4) + private Integer no; + + @Column(nullable = false, length = 50) + private String city; + + @Column(nullable = false, length = 2) + private String county; + + @Column(nullable = false, scale = 5) + private Integer zipCode; + + public Address() + { + } + + public Address(String street, Integer no, String city, String county, Integer zipCode) + { + this.street = street; + this.no = no; + this.city = city; + this.county = county; + this.zipCode = zipCode; + } + + /** + * @return the id + */ + public Long getId() + { + return id; + } + + /** + * @param id the id to set + */ + public void setId(Long id) + { + this.id = id; + } + + /** + * @return the street + */ + public String getStreet() + { + return street; + } + + /** + * @param street the street to set + */ + public void setStreet(String street) + { + this.street = street; + } + + /** + * @return the no + */ + public Integer getNo() + { + return no; + } + + /** + * @param no the no to set + */ + public void setNo(Integer no) + { + this.no = no; + } + + /** + * @return the city + */ + public String getCity() + { + return city; + } + + /** + * @param city the city to set + */ + public void setCity(String city) + { + this.city = city; + } + + /** + * @return the county + */ + public String getCounty() + { + return county; + } + + /** + * @param county the county to set + */ + public void setCounty(String county) + { + this.county = county; + } + + /** + * @return the zipCode + */ + public Integer getZipCode() + { + return zipCode; + } + + /** + * @param zipCode the zipCode to set + */ + public void setZipCode(Integer zipCode) + { + this.zipCode = zipCode; + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + ((city == null) ? 0 : city.hashCode()); + result = prime * result + ((county == null) ? 0 : county.hashCode()); + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((no == null) ? 0 : no.hashCode()); + result = prime * result + ((street == null) ? 0 : street.hashCode()); + result = prime * result + ((zipCode == null) ? 0 : zipCode.hashCode()); + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (getClass() != obj.getClass()) + { + return false; + } + Address other = (Address) obj; + if (city == null) + { + if (other.city != null) + { + return false; + } + } + else if (!city.equals(other.city)) + { + return false; + } + if (county == null) + { + if (other.county != null) + { + return false; + } + } + else if (!county.equals(other.county)) + { + return false; + } + if (id == null) + { + if (other.id != null) + { + return false; + } + } + else if (!id.equals(other.id)) + { + return false; + } + if (no == null) + { + if (other.no != null) + { + return false; + } + } + else if (!no.equals(other.no)) + { + return false; + } + if (street == null) + { + if (other.street != null) + { + return false; + } + } + else if (!street.equals(other.street)) + { + return false; + } + if (zipCode == null) + { + if (other.zipCode != null) + { + return false; + } + } + else if (!zipCode.equals(other.zipCode)) + { + return false; + } + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() + { + return "Address [city=" + + city + + ", county=" + + county + + ", id=" + + id + + ", no=" + + no + + ", street=" + + street + + ", zipCode=" + + zipCode + + "]"; + } + +} Property changes on: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Address.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Chance.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Chance.java (rev 0) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Chance.java 2010-05-09 17:10:25 UTC (rev 2373) @@ -0,0 +1,13 @@ +/** + * + */ +package it.openutils.hibernate.test.model; + +/** + * @author gcatania + */ +public enum Chance { + + /** chance. */ + TOTALLY_REMOTE, VAGUELY_POSSIBLE, QUITE_POSSIBLE, CAKEWALK_EASY +} Property changes on: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Chance.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FantasticThing.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FantasticThing.java (rev 0) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FantasticThing.java 2010-05-09 17:10:25 UTC (rev 2373) @@ -0,0 +1,214 @@ +/** + * + * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * + * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * You may obtain a copy of the License at + * + * http://www.gnu.org/licenses/lgpl-2.1.html + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package it.openutils.hibernate.test.model; + +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToMany; + + +/** + * @author gcatania + */ +@Entity +public class FantasticThing +{ + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + private String thingName; + + private Chance chanceOfAchievement; + + @ManyToMany(mappedBy = "objectsOfWish", cascade = CascadeType.ALL) + private Set<Wish> wishes; + + public FantasticThing() + { + } + + public FantasticThing(String thingName, Chance chanceOfAchievement) + { + this.thingName = thingName; + this.chanceOfAchievement = chanceOfAchievement; + } + + /** + * @return the id + */ + public Long getId() + { + return id; + } + + /** + * @param id the id to set + */ + public void setId(Long id) + { + this.id = id; + } + + /** + * @return the thingName + */ + public String getThingName() + { + return thingName; + } + + /** + * @param thingName the thingName to set + */ + public void setThingName(String thingName) + { + this.thingName = thingName; + } + + /** + * @return the chanceOfAchievement + */ + public Chance getChanceOfAchievement() + { + return chanceOfAchievement; + } + + /** + * @param chanceOfAchievement the chanceOfAchievement to set + */ + public void setChanceOfAchievement(Chance chanceOfAchievement) + { + this.chanceOfAchievement = chanceOfAchievement; + } + + /** + * @return the wishes + */ + public Set<Wish> getWishes() + { + return wishes; + } + + /** + * @param wishes the wishes to set + */ + public void setWishes(Set<Wish> wishes) + { + this.wishes = wishes; + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + ((chanceOfAchievement == null) ? 0 : chanceOfAchievement.hashCode()); + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((thingName == null) ? 0 : thingName.hashCode()); + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (getClass() != obj.getClass()) + { + return false; + } + FantasticThing other = (FantasticThing) obj; + if (chanceOfAchievement == null) + { + if (other.chanceOfAchievement != null) + { + return false; + } + } + else if (!chanceOfAchievement.equals(other.chanceOfAchievement)) + { + return false; + } + if (id == null) + { + if (other.id != null) + { + return false; + } + } + else if (!id.equals(other.id)) + { + return false; + } + if (thingName == null) + { + if (other.thingName != null) + { + return false; + } + } + else if (!thingName.equals(other.thingName)) + { + return false; + } + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() + { + return "FantasticThing [chanceOfAchievement=" + + chanceOfAchievement + + ", id=" + + id + + ", thingName=" + + thingName + + "]"; + } + +} Property changes on: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FantasticThing.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FullName.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FullName.java (rev 0) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FullName.java 2010-05-09 17:10:25 UTC (rev 2373) @@ -0,0 +1,161 @@ +/** + * + */ +package it.openutils.hibernate.test.model; + +import javax.persistence.Column; +import javax.persistence.Embeddable; + + +/** + * @author gcatania + */ +@Embeddable +public class FullName +{ + + private Title title; + + @Column(nullable = false) + private String givenName; + + @Column(nullable = false) + private String familyName; + + public FullName() + { + } + + public FullName(String givenName, String familyName) + { + this.givenName = givenName; + this.familyName = familyName; + } + + /** + * @return the title + */ + public Title getTitle() + { + return title; + } + + /** + * @param title the title to set + */ + public void setTitle(Title title) + { + this.title = title; + } + + /** + * @return the givenName + */ + public String getGivenName() + { + return givenName; + } + + /** + * @param givenName the givenName to set + */ + public void setGivenName(String givenName) + { + this.givenName = givenName; + } + + /** + * @return the familyName + */ + public String getFamilyName() + { + return familyName; + } + + /** + * @param familyName the familyName to set + */ + public void setFamilyName(String familyName) + { + this.familyName = familyName; + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + ((familyName == null) ? 0 : familyName.hashCode()); + result = prime * result + ((givenName == null) ? 0 : givenName.hashCode()); + result = prime * result + ((title == null) ? 0 : title.hashCode()); + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (getClass() != obj.getClass()) + { + return false; + } + FullName other = (FullName) obj; + if (familyName == null) + { + if (other.familyName != null) + { + return false; + } + } + else if (!familyName.equals(other.familyName)) + { + return false; + } + if (givenName == null) + { + if (other.givenName != null) + { + return false; + } + } + else if (!givenName.equals(other.givenName)) + { + return false; + } + if (title == null) + { + if (other.title != null) + { + return false; + } + } + else if (!title.equals(other.title)) + { + return false; + } + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() + { + return "FullName [familyName=" + familyName + ", givenName=" + givenName + ", title=" + title + "]"; + } + +} Property changes on: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FullName.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Person.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Person.java (rev 0) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Person.java 2010-05-09 17:10:25 UTC (rev 2373) @@ -0,0 +1,284 @@ +/** + * + * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * + * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * You may obtain a copy of the License at + * + * http://www.gnu.org/licenses/lgpl-2.1.html + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package it.openutils.hibernate.test.model; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; + + +/** + * @author gcatania + */ +@Entity +public class Person +{ + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + @Embedded + private FullName name; + + @Column(nullable = false, scale = 3) + private Integer age; + + @ManyToOne(fetch = FetchType.EAGER, optional = false, cascade = CascadeType.ALL) + private Address currentAddress; + + @ManyToOne(cascade = CascadeType.ALL) + private Address fiscalAddress; + + @OneToOne + private Wish wish; + + public Person() + { + } + + public Person(FullName name, Integer age, Address currentAddress, Address fiscalAddress) + { + this.name = name; + this.age = age; + this.currentAddress = currentAddress; + this.fiscalAddress = fiscalAddress; + } + + /** + * @return the id + */ + public Long getId() + { + return id; + } + + /** + * @param id the id to set + */ + public void setId(Long id) + { + this.id = id; + } + + /** + * @return the name + */ + public FullName getName() + { + return name; + } + + /** + * @param name the name to set + */ + public void setName(FullName name) + { + this.name = name; + } + + /** + * @return the currentAddress + */ + public Address getCurrentAddress() + { + return currentAddress; + } + + /** + * @param currentAddress the currentAddress to set + */ + public void setCurrentAddress(Address currentAddress) + { + this.currentAddress = currentAddress; + } + + /** + * @return the fiscalAddress + */ + public Address getFiscalAddress() + { + return fiscalAddress; + } + + /** + * @param fiscalAddress the fiscalAddress to set + */ + public void setFiscalAddress(Address fiscalAddress) + { + this.fiscalAddress = fiscalAddress; + } + + /** + * @return the wish + */ + public Wish getWish() + { + return wish; + } + + /** + * @param wish the wish to set + */ + public void setWish(Wish wish) + { + this.wish = wish; + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + ((age == null) ? 0 : age); + result = prime * result + ((currentAddress == null) ? 0 : currentAddress.hashCode()); + result = prime * result + ((fiscalAddress == null) ? 0 : fiscalAddress.hashCode()); + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((wish == null) ? 0 : wish.hashCode()); + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (getClass() != obj.getClass()) + { + return false; + } + Person other = (Person) obj; + if (age == null) + { + if (other.age != null) + { + return false; + } + } + else if (!age.equals(other.age)) + { + return false; + } + if (currentAddress == null) + { + if (other.currentAddress != null) + { + return false; + } + } + else if (!currentAddress.equals(other.currentAddress)) + { + return false; + } + if (fiscalAddress == null) + { + if (other.fiscalAddress != null) + { + return false; + } + } + else if (!fiscalAddress.equals(other.fiscalAddress)) + { + return false; + } + if (id == null) + { + if (other.id != null) + { + return false; + } + } + else if (!id.equals(other.id)) + { + return false; + } + if (name == null) + { + if (other.name != null) + { + return false; + } + } + else if (!name.equals(other.name)) + { + return false; + } + if (wish == null) + { + if (other.wish != null) + { + return false; + } + } + else if (!wish.equals(other.wish)) + { + return false; + } + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() + { + return "Person [age=" + + age + + ", currentAddress=" + + currentAddress + + ", fiscalAddress=" + + fiscalAddress + + ", id=" + + id + + ", name=" + + name + + ", wish=" + + wish + + "]"; + } + +} Property changes on: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Person.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Title.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Title.java (rev 0) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Title.java 2010-05-09 17:10:25 UTC (rev 2373) @@ -0,0 +1,14 @@ +/** + * + */ +package it.openutils.hibernate.test.model; + +/** + * @author gcatania + */ +public enum Title { + + /** male, female titles */ + MR, MRS + +} Property changes on: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Title.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Wish.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Wish.java (rev 0) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Wish.java 2010-05-09 17:10:25 UTC (rev 2373) @@ -0,0 +1,238 @@ +/** + * + */ +package it.openutils.hibernate.test.model; + +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToMany; +import javax.persistence.OneToOne; +import javax.persistence.Transient; + + +/** + * @author gcatania + */ +@Entity +public class Wish +{ + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + @OneToOne(mappedBy = "wish", optional = false, cascade = CascadeType.ALL) + private Person person; + + @Column(nullable = false) + private String reason; + + @ManyToMany(cascade = CascadeType.ALL) + private Set<FantasticThing> objectsOfWish; + + @Transient + private Integer objectCount; + + public Wish() + { + } + + public Wish(Person person, String reason) + { + this.person = person; + this.reason = reason; + } + + /** + * @return the id + */ + public Long getId() + { + return id; + } + + /** + * @param id the id to set + */ + public void setId(Long id) + { + this.id = id; + } + + /** + * @return the person + */ + public Person getPerson() + { + return person; + } + + /** + * @param person the person to set + */ + public void setPerson(Person person) + { + this.person = person; + } + + /** + * @return the reason + */ + public String getReason() + { + return reason; + } + + /** + * @param reason the reason to set + */ + public void setReason(String reason) + { + this.reason = reason; + } + + /** + * @return the objectsOfWish + */ + public Set<FantasticThing> getObjectsOfWish() + { + return objectsOfWish; + } + + /** + * @param objectsOfWish the objectsOfWish to set + */ + public void setObjectsOfWish(Set<FantasticThing> objectsOfWish) + { + this.objectsOfWish = objectsOfWish; + } + + /** + * @return the objectCount + */ + public Integer getObjectCount() + { + if (objectCount == null) + { + objectCount = objectsOfWish.size(); + } + return objectCount; + } + + /** + * @param objectCount the objectCount to set + */ + public void setObjectCount(Integer objectCount) + { + if (objectCount != null && objectCount != objectsOfWish.size()) + { + throw new IllegalArgumentException(); + } + this.objectCount = objectCount; + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((objectCount == null) ? 0 : objectCount.hashCode()); + result = prime * result + ((objectsOfWish == null) ? 0 : objectsOfWish.hashCode()); + result = prime * result + ((reason == null) ? 0 : reason.hashCode()); + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (getClass() != obj.getClass()) + { + return false; + } + Wish other = (Wish) obj; + if (id == null) + { + if (other.id != null) + { + return false; + } + } + else if (!id.equals(other.id)) + { + return false; + } + if (objectCount == null) + { + if (other.objectCount != null) + { + return false; + } + } + else if (!objectCount.equals(other.objectCount)) + { + return false; + } + if (objectsOfWish == null) + { + if (other.objectsOfWish != null) + { + return false; + } + } + else if (!objectsOfWish.equals(other.objectsOfWish)) + { + return false; + } + if (reason == null) + { + if (other.reason != null) + { + return false; + } + } + else if (!reason.equals(other.reason)) + { + return false; + } + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() + { + return "Wish [id=" + + id + + ", objectCount=" + + objectCount + + ", objectsOfWish=" + + objectsOfWish + + ", reason=" + + reason + + "]"; + } + +} Property changes on: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Wish.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/test/resources/hibernate.cfg.xml =================================================================== --- trunk/openutils-bshd5/src/test/resources/hibernate.cfg.xml (rev 0) +++ trunk/openutils-bshd5/src/test/resources/hibernate.cfg.xml 2010-05-09 17:10:25 UTC (rev 2373) @@ -0,0 +1,12 @@ +<!DOCTYPE hibernate-configuration PUBLIC + "-//Hibernate/Hibernate Configuration DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> +<hibernate-configuration> + <session-factory> + <mapping class="it.openutils.hibernate.test.model.Address" /> + <mapping class="it.openutils.hibernate.test.model.FantasticThing" /> + <mapping class="it.openutils.hibernate.test.model.FullName" /> + <mapping class="it.openutils.hibernate.test.model.Person" /> + <mapping class="it.openutils.hibernate.test.model.Wish" /> + </session-factory> +</hibernate-configuration> \ No newline at end of file Property changes on: trunk/openutils-bshd5/src/test/resources/hibernate.cfg.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-bshd5/src/test/resources/spring-tests.xml =================================================================== --- trunk/openutils-bshd5/src/test/resources/spring-tests.xml (rev 0) +++ trunk/openutils-bshd5/src/test/resources/spring-tests.xml 2010-05-09 17:10:25 UTC (rev 2373) @@ -0,0 +1,31 @@ +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/aop + http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-2.5.xsd"> + <context:annotation-config /> + <context:component-scan base-package="it.openutils.hibernate.test" /> + <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> + <property name="driverClassName" value="org.hsqldb.jdbcDriver" /> + <property name="url" value="jdbc:hsqldb:mem:daotest" /> + <property name="username" value="sa" /> + <property name="password" value="" /> + </bean> + <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> + <property name="dataSource" ref="dataSource" /> + <property name="configLocation" value="classpath:hibernate.cfg.xml" /> + <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" /> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop> + <prop key="hibernate.show_sql">true</prop> + <prop key="hibernate.hbm2ddl.auto">create-drop</prop> + </props> + </property> + </bean> +</beans> \ No newline at end of file Property changes on: trunk/openutils-bshd5/src/test/resources/spring-tests.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2011-06-04 08:01:52
|
Revision: 3499 http://openutils.svn.sourceforge.net/openutils/?rev=3499&view=rev Author: fgiust Date: 2011-06-04 08:01:45 +0000 (Sat, 04 Jun 2011) Log Message: ----------- license headers Modified Paths: -------------- trunk/openutils-bshd5/pom.xml trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/EnhancedExample.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadata.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResult.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResultImpl.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResultUtils.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/HibernateDAOTest.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/dao/PersonDAO.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Address.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Chance.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FantasticThing.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FullName.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Person.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Title.java trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Wish.java Modified: trunk/openutils-bshd5/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/pom.xml 2011-06-04 08:01:45 UTC (rev 3499) @@ -8,9 +8,9 @@ <version>1.9</version> </parent> <artifactId>openutils-bshd5</artifactId> - <name>openutils base Spring-Hibernate DAO for java 5.0</name> + <name>openutils base Spring-Hibernate DAO</name> <version>2.0.7-SNAPSHOT</version> - <description>Openutils base Spring-Hibernate DAO for java 5.0</description> + <description>Openutils base Spring-Hibernate DAO (for java 5 and more)</description> <licenses> <license> <name>The Apache Software License, Version 2.0</name> @@ -22,6 +22,7 @@ <system>jira</system> <url>http://jira.openmindlab.com/browse/BSHD</url> </issueManagement> + <inceptionYear>2005</inceptionYear> <build> <plugins> <plugin> @@ -157,15 +158,7 @@ <version>${spring.version}</version> <scope>test</scope> </dependency> - <!-- <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-aspects</artifactId> - <version>${spring.version}</version> - <scope>test</scope> - </dependency> - --> - <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>5.7</version> @@ -202,4 +195,4 @@ <properties> <spring.version>3.0.0.RELEASE</spring.version> </properties> -</project> +</project> \ No newline at end of file Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/EnhancedExample.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/EnhancedExample.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/EnhancedExample.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadata.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadata.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadata.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResult.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResult.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResult.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResultImpl.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResultImpl.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResultImpl.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResultUtils.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResultUtils.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/paging/PaginatedResultUtils.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/HibernateDAOTest.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/HibernateDAOTest.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/HibernateDAOTest.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/dao/PersonDAO.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/dao/PersonDAO.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/dao/PersonDAO.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Address.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Address.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Address.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Chance.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Chance.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Chance.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FantasticThing.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FantasticThing.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FantasticThing.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FullName.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FullName.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/FullName.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Person.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Person.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Person.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Title.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Title.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Title.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or Modified: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Wish.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Wish.java 2011-06-04 07:59:28 UTC (rev 3498) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/test/model/Wish.java 2011-06-04 08:01:45 UTC (rev 3499) @@ -1,8 +1,8 @@ /** * - * openutils base Spring-Hibernate DAO for java 5.0 (http://www.openmindlab.com/lab/products/bshd5.html) + * openutils base Spring-Hibernate DAO (http://www.openmindlab.com/lab/products/bshd5.html) * - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2005-2011, Openmind S.r.l. http://www.openmindonline.it * * * This library is free software; you can redistribute it and/or This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gca...@us...> - 2012-06-06 21:28:44
|
Revision: 4057 http://openutils.svn.sourceforge.net/openutils/?rev=4057&view=rev Author: gcatania Date: 2012-06-06 21:28:38 +0000 (Wed, 06 Jun 2012) Log Message: ----------- BSHD-10 dependency update Modified Paths: -------------- trunk/openutils-bshd5/pom.xml trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java Modified: trunk/openutils-bshd5/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2012-06-06 09:03:25 UTC (rev 4056) +++ trunk/openutils-bshd5/pom.xml 2012-06-06 21:28:38 UTC (rev 4057) @@ -52,12 +52,12 @@ <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> - <version>1.6.1</version> + <version>${slf4j.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> - <version>1.6.1</version> + <version>${slf4j.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> @@ -84,7 +84,7 @@ <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> - <version>3.5.6-Final</version> + <version>${hibernate.version}</version> <exclusions> <exclusion> <groupId>cglib</groupId> @@ -106,14 +106,14 @@ <version>3.2.1</version> </dependency> <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.4</version> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.1</version> </dependency> <dependency> <groupId>org.javassist</groupId> <artifactId>javassist</artifactId> - <version>3.16.1-GA</version> + <version>${javassist.version}</version> </dependency> <!-- test dependencies --> <dependency> @@ -143,7 +143,7 @@ <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> - <version>3.5.6-Final</version> + <version>${hibernate.version}</version> <scope>test</scope> <exclusions> <exclusion> @@ -162,6 +162,9 @@ </dependency> </dependencies> <properties> + <slf4j.version>1.6.5</slf4j.version> + <hibernate.version>3.5.6-Final</hibernate.version> + <javassist.version>3.16.1-GA</javassist.version> <spring.version>3.0.0.RELEASE</spring.version> </properties> </project> Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2012-06-06 09:03:25 UTC (rev 4056) +++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2012-06-06 21:28:38 UTC (rev 4057) @@ -39,7 +39,7 @@ import org.aopalliance.aop.AspectException; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.hibernate.Criteria; import org.hibernate.Hibernate; import org.hibernate.HibernateException; @@ -166,7 +166,7 @@ */ public List<T> find(String query, Object paramValue, Type paramType) { - return getThis().find(query, new Object[]{paramValue}, new Type[]{paramType}); + return getThis().find(query, new Object[]{paramValue }, new Type[]{paramType }); } /** Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java 2012-06-06 09:03:25 UTC (rev 4056) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java 2012-06-06 21:28:38 UTC (rev 4057) @@ -37,7 +37,7 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.hibernate.Criteria; import org.hibernate.EntityMode; import org.hibernate.Hibernate; Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java 2012-06-06 09:03:25 UTC (rev 4056) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java 2012-06-06 21:28:38 UTC (rev 4057) @@ -33,7 +33,7 @@ import java.util.Set; import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.hibernate.Criteria; import org.hibernate.EntityMode; import org.hibernate.Hibernate; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gca...@us...> - 2012-07-05 14:49:14
|
Revision: 4092 http://openutils.svn.sourceforge.net/openutils/?rev=4092&view=rev Author: gcatania Date: 2012-07-05 14:49:05 +0000 (Thu, 05 Jul 2012) Log Message: ----------- BSHD-17 added derby profile for unit tests Modified Paths: -------------- trunk/openutils-bshd5/pom.xml trunk/openutils-bshd5/src/test/resources/spring-tests.xml Modified: trunk/openutils-bshd5/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2012-07-05 14:42:38 UTC (rev 4091) +++ trunk/openutils-bshd5/pom.xml 2012-07-05 14:49:05 UTC (rev 4092) @@ -29,6 +29,12 @@ <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/trunk/openutils-bshd5</url> </scm> <build> + <testResources> + <testResource> + <filtering>true</filtering> + <directory>src/test/resources</directory> + </testResource> + </testResources> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> @@ -142,12 +148,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.hsqldb</groupId> - <artifactId>hsqldb</artifactId> - <version>2.2.6</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>${hibernate.version}</version> @@ -174,4 +174,61 @@ <javassist.version>3.16.1-GA</javassist.version> <spring.version>3.0.0.RELEASE</spring.version> </properties> + + <profiles> + <profile> + <id>test-hsql</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <hibernate.driver>org.hsqldb.jdbcDriver</hibernate.driver> + <hibernate.url>jdbc:hsqldb:mem:daotest</hibernate.url> + <hibernate.user>sa</hibernate.user> + <hibernate.password></hibernate.password> + <hibernate.dialect>org.hibernate.dialect.HSQLDialect</hibernate.dialect> + </properties> + <dependencies> + <dependency> + <groupId>org.hsqldb</groupId> + <artifactId>hsqldb</artifactId> + <version>2.2.8</version> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + <profile> + <id>test-derby</id> + <properties> + <hibernate.driver>org.apache.derby.jdbc.EmbeddedDriver</hibernate.driver> + <hibernate.url>jdbc:derby:memory:daotest;create=true</hibernate.url> + <hibernate.user>sa</hibernate.user> + <hibernate.password></hibernate.password> + <hibernate.dialect>org.hibernate.dialect.DerbyDialect</hibernate.dialect> + </properties> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <systemProperties> + <property> + <name>derby.stream.error.file</name> + <value>${project.build.directory}/derby.log</value> + </property> + </systemProperties> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.9.1.0</version> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + </profiles> </project> Modified: trunk/openutils-bshd5/src/test/resources/spring-tests.xml =================================================================== --- trunk/openutils-bshd5/src/test/resources/spring-tests.xml 2012-07-05 14:42:38 UTC (rev 4091) +++ trunk/openutils-bshd5/src/test/resources/spring-tests.xml 2012-07-05 14:49:05 UTC (rev 4092) @@ -11,10 +11,10 @@ <context:annotation-config /> <context:component-scan base-package="it.openutils.hibernate.test" /> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> - <property name="driverClassName" value="org.hsqldb.jdbcDriver" /> - <property name="url" value="jdbc:hsqldb:mem:daotest" /> - <property name="username" value="sa" /> - <property name="password" value="" /> + <property name="driverClassName" value="${hibernate.driver}" /> + <property name="url" value="${hibernate.url}" /> + <property name="username" value="${hibernate.user}" /> + <property name="password" value="${hibernate.password}" /> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> @@ -22,7 +22,7 @@ <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" /> <property name="hibernateProperties"> <props> - <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop> + <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">create-drop</prop> </props> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gca...@us...> - 2012-07-05 15:04:08
|
Revision: 4094 http://openutils.svn.sourceforge.net/openutils/?rev=4094&view=rev Author: gcatania Date: 2012-07-05 15:03:58 +0000 (Thu, 05 Jul 2012) Log Message: ----------- BSHD-16 hibernate 4 compatbility changes Modified Paths: -------------- trunk/openutils-bshd5/pom.xml trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTreeUtils.java trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java trunk/openutils-bshd5/src/test/resources/hibernate.cfg.xml trunk/openutils-bshd5/src/test/resources/spring-tests.xml Modified: trunk/openutils-bshd5/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2012-07-05 14:55:25 UTC (rev 4093) +++ trunk/openutils-bshd5/pom.xml 2012-07-05 15:03:58 UTC (rev 4094) @@ -53,7 +53,14 @@ </descriptors> </configuration> </plugin> - <plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <!-- BSHD-16 without manifest only jar, hibernate has classpath issues --> + <useManifestOnlyJar>true</useManifestOnlyJar> + </configuration> + </plugin> + <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.3.7</version> @@ -147,6 +154,7 @@ <version>6.5.2</version> <scope>test</scope> </dependency> +<!-- <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> @@ -167,10 +175,11 @@ </exclusion> </exclusions> </dependency> +--> </dependencies> <properties> <slf4j.version>1.6.6</slf4j.version> - <hibernate.version>3.5.6-Final</hibernate.version> + <hibernate.version>4.1.1.Final</hibernate.version> <javassist.version>3.16.1-GA</javassist.version> <spring.version>3.1.1.RELEASE</spring.version> </properties> @@ -204,7 +213,7 @@ <hibernate.url>jdbc:derby:memory:daotest;create=true</hibernate.url> <hibernate.user>sa</hibernate.user> <hibernate.password></hibernate.password> - <hibernate.dialect>org.hibernate.dialect.DerbyDialect</hibernate.dialect> + <hibernate.dialect>org.hibernate.dialect.DerbyTenSevenDialect</hibernate.dialect> </properties> <build> <plugins> Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java 2012-07-05 14:55:25 UTC (rev 4093) +++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java 2012-07-05 15:03:58 UTC (rev 4094) @@ -318,7 +318,9 @@ * Load object matching the given key and return it. Lazy object will be initialized. * @param key the id of the entity instance to load * @return the found entity instance, or null if none found + * @deprecated same as {@link #get(Serializable)} */ + @Deprecated T loadIfAvailable(K key); /** Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2012-07-05 14:55:25 UTC (rev 4093) +++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2012-07-05 15:03:58 UTC (rev 4094) @@ -30,7 +30,6 @@ import it.openutils.hibernate.example.FilterMetadataSupport; import java.io.Serializable; -import java.sql.SQLException; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -42,9 +41,9 @@ import org.apache.commons.lang3.StringUtils; import org.hibernate.Criteria; import org.hibernate.Hibernate; -import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; +import org.hibernate.SessionFactory; import org.hibernate.criterion.CriteriaSpecification; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Order; @@ -52,9 +51,9 @@ import org.hibernate.criterion.Projections; import org.hibernate.criterion.Property; import org.hibernate.type.Type; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.aop.framework.AopContext; -import org.springframework.orm.hibernate3.HibernateCallback; -import org.springframework.orm.hibernate3.support.HibernateDaoSupport; /** @@ -64,11 +63,13 @@ * @param <T> Persistence class * @param <K> Object Key */ -public abstract class HibernateDAOImpl<T, K extends Serializable> extends HibernateDaoSupport - implements - HibernateDAO<T, K> +public abstract class HibernateDAOImpl<T, K extends Serializable> implements HibernateDAO<T, K> { + private final Logger logger = LoggerFactory.getLogger(getClass()); + + private SessionFactory sessionFactory; + private Class<T> referenceClass; private boolean aopenabled; @@ -106,7 +107,21 @@ this.referenceClass = referenceClass; } + private Session getCurrentSession() + { + return sessionFactory.getCurrentSession(); + } + /** + * creates a criteria for this dao's reference class, associated to the current session + * @return a new criteria for the reference class + */ + private Criteria createCriteria() + { + return getCurrentSession().createCriteria(getReferenceClass()); + } + + /** * {@inheritDoc} */ public List<T> findAll() @@ -128,29 +143,22 @@ */ public List<T> find(final List< ? extends Criterion> criteria, final Order... orders) { - return getHibernateTemplate().execute(new HibernateCallback<List<T>>() + Criteria crit = createCriteria(); + if (criteria != null) { - - public List<T> doInHibernate(final Session ses) throws HibernateException + for (Criterion c : criteria) { - Criteria crit = ses.createCriteria(getReferenceClass()); - if (criteria != null) - { - for (Criterion c : criteria) - { - crit.add(c); - } - } - if (orders != null) - { - for (Order o : orders) - { - crit.addOrder(o); - } - } - return crit.list(); + crit.add(c); } - }); + } + if (orders != null) + { + for (Order o : orders) + { + crit.addOrder(o); + } + } + return crit.list(); } /** @@ -158,7 +166,7 @@ */ public List<T> find(String query) { - return getHibernateTemplate().find(query); + return getCurrentSession().createQuery(query).list(); } /** @@ -174,15 +182,7 @@ */ public List<T> find(final String query, final Object[] paramValues, final Type[] paramTypes) { - return getHibernateTemplate().execute(new HibernateCallback<List<T>>() - { - - public List<T> doInHibernate(final Session ses) throws HibernateException - { - // hibernate 3 - return ses.createQuery(query).setParameters(paramValues, paramTypes).list(); - } - }); + return getCurrentSession().createQuery(query).setParameters(paramValues, paramTypes).list(); } /** @@ -312,23 +312,18 @@ */ public T load(K key) { - T result = getHibernateTemplate().load(getReferenceClass(), key); + T result = (T) sessionFactory.getCurrentSession().load(getReferenceClass(), key); Hibernate.initialize(result); return result; } /** - * {@inheritDoc} + * @deprecated same as {@link #get(Serializable)}; */ + @Deprecated public T loadIfAvailable(K key) { - T result = getHibernateTemplate().get(getReferenceClass(), key); - if (result != null) - { - Hibernate.initialize(result); - return result; - } - return null; + return get(key); } /** @@ -336,7 +331,7 @@ */ public T get(K key) { - return getHibernateTemplate().get(getReferenceClass(), key); + return (T) sessionFactory.getCurrentSession().get(getReferenceClass(), key); } /** @@ -344,7 +339,7 @@ */ public K save(T obj) { - return (K) getHibernateTemplate().save(obj); + return (K) sessionFactory.getCurrentSession().save(obj); } /** @@ -352,7 +347,7 @@ */ public void update(T obj) { - getHibernateTemplate().update(obj); + sessionFactory.getCurrentSession().update(obj); } /** @@ -360,7 +355,7 @@ */ public void saveOrUpdate(T obj) { - getHibernateTemplate().saveOrUpdate(obj); + sessionFactory.getCurrentSession().saveOrUpdate(obj); } /** @@ -368,15 +363,10 @@ */ public boolean delete(final K key) { - return getHibernateTemplate().execute(new HibernateCallback<Boolean>() - { - - public Boolean doInHibernate(final Session ses) throws HibernateException - { - ses.delete(ses.load(getReferenceClass(), key)); - return true; - } - }); + Session s = getCurrentSession(); + Object toDelete = s.load(getReferenceClass(), key); + s.delete(toDelete); + return true; } /** @@ -384,7 +374,7 @@ */ public void refresh(T obj) { - getHibernateTemplate().refresh(obj); + getCurrentSession().refresh(obj); } /** @@ -392,7 +382,7 @@ */ public void evict(T obj) { - getHibernateTemplate().evict(obj); + getCurrentSession().evict(obj); } /** @@ -400,15 +390,7 @@ */ public T merge(final T obj) { - return getHibernateTemplate().execute(new HibernateCallback<T>() - { - - public T doInHibernate(final Session ses) throws HibernateException - { - return (T) ses.merge(obj); - } - }); - + return (T) getCurrentSession().merge(obj); } /** @@ -425,7 +407,7 @@ */ public List<T> findFiltered(ExampleTree exampleTree, int maxResults, int page, Order... orders) { - return getHibernateTemplate().execute(new ExampleTreeCallback<T>(exampleTree, maxResults, page, orders)); + return new ExampleTreeCallback<T>(exampleTree, maxResults, page, orders).doInHibernate(getCurrentSession()); } /** @@ -443,8 +425,8 @@ public List<Object> findFilteredProperties(ExampleTree exampleTree, int maxResults, int page, List<String> properties, Order... orders) { - return getHibernateTemplate().execute( - new ExampleTreePropertiesCallback(exampleTree, maxResults, page, properties, orders)); + return new ExampleTreePropertiesCallback(exampleTree, maxResults, page, properties, orders) + .doInHibernate(getCurrentSession()); } /** @@ -483,7 +465,7 @@ public List<T> findFiltered(T filter, Map<String, ? extends FilterMetadata> metadata, int maxResults, int page, List< ? extends Criterion> criteria, Order... orders) { - HibernateCallback<List<T>> callback; + BaseCallback<T> callback; if (MapUtils.isEmpty(metadata) && CollectionUtils.isEmpty(criteria)) { callback = new ExampleTreeCallback<T>(defaultExample(filter), maxResults, page, orders); @@ -492,7 +474,7 @@ { callback = new LegacySupportCallback<T>(filter, maxResults, page, metadata, criteria, orders); } - return getHibernateTemplate().execute(callback); + return callback.doInHibernate(getCurrentSession()); } /** @@ -515,7 +497,7 @@ Map<String, ? extends FilterMetadata> metadata, int maxResults, int page, List< ? extends Criterion> criteria, List<String> properties) { - HibernateCallback<List<Object>> callback; + BaseCallback<Object> callback; if (MapUtils.isEmpty(metadata) && CollectionUtils.isEmpty(criteria)) { callback = new ExampleTreePropertiesCallback(defaultExample(filter), maxResults, page, properties, orders); @@ -531,7 +513,7 @@ properties, orders); } - return getHibernateTemplate().execute(callback); + return callback.doInHibernate(getCurrentSession()); } /** @@ -575,26 +557,19 @@ */ protected List<Object> findByNamedQuery(final String name, final Serializable[] params, final Integer maxResults) { - return getHibernateTemplate().execute(new HibernateCallback<List<Object>>() + Query q = getCurrentSession().getNamedQuery(name); + if (maxResults != null) { - - public List<Object> doInHibernate(final Session ses) throws HibernateException + q.setMaxResults(maxResults); + } + if (params != null) + { + for (int i = 0; i < params.length; i++) { - Query q = ses.getNamedQuery(name); - if (maxResults != null) - { - q.setMaxResults(maxResults); - } - if (params != null) - { - for (int i = 0; i < params.length; i++) - { - q.setParameter(i, params[i]); - } - } - return q.list(); + q.setParameter(i, params[i]); } - }); + } + return q.list(); } /** @@ -606,27 +581,20 @@ */ protected List<Object> findByNamedQuery(final String name, final Map<String, ? > params, final Integer maxResults) { - return getHibernateTemplate().execute(new HibernateCallback<List<Object>>() + Query q = getCurrentSession().getNamedQuery(name); + if (maxResults != null) { + q.setMaxResults(maxResults); + } - public List<Object> doInHibernate(final Session ses) throws HibernateException + if (params != null) + { + for (Map.Entry<String, ? > entry : params.entrySet()) { - Query q = ses.getNamedQuery(name); - if (maxResults != null) - { - q.setMaxResults(maxResults); - } - - if (params != null) - { - for (Map.Entry<String, ? > entry : params.entrySet()) - { - setParameterValue(q, entry.getKey(), entry.getValue()); - } - } - return q.list(); + setParameterValue(q, entry.getKey(), entry.getValue()); } - }); + } + return q.list(); } /** @@ -743,17 +711,33 @@ } catch (AspectException exc) { - logger.debug("Not running inside an AOP proxy, so no proxy can be returned: " + exc.getMessage()); + logger.debug("Not running inside an AOP proxy, so no proxy can be returned: {}", exc.getMessage()); } catch (IllegalStateException e) { - logger.warn("Cannot access proxy: " + e.getMessage()); + logger.warn("Cannot access proxy: {}", e.getMessage()); aopenabled = false; } return this; } /** + * @param sessionFactory the sessionFactory to set + */ + public void setSessionFactory(SessionFactory sessionFactory) + { + this.sessionFactory = sessionFactory; + } + + /** + * @return the sessionFactory + */ + public SessionFactory getSessionFactory() + { + return sessionFactory; + } + + /** * @author gcatania */ @SuppressWarnings("deprecation") @@ -847,7 +831,7 @@ * @author gcatania * @param R the result class */ -abstract class BaseCallback<R> implements HibernateCallback<List<R>> +abstract class BaseCallback<R> { private final Order[] orders; @@ -870,7 +854,7 @@ */ protected abstract Criteria createCriteria(Session session); - public final List<R> doInHibernate(Session session) throws HibernateException, SQLException + public final List<R> doInHibernate(Session session) { Criteria crit = createCriteria(session); crit.setMaxResults(maxResults); Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java 2012-07-05 14:55:25 UTC (rev 4093) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTree.java 2012-07-05 15:03:58 UTC (rev 4094) @@ -37,7 +37,6 @@ import java.util.Set; import org.hibernate.Criteria; -import org.hibernate.EntityMode; import org.hibernate.Hibernate; import org.hibernate.Session; import org.hibernate.SessionFactory; @@ -239,12 +238,9 @@ private final SessionFactory sessionFactory; - private final EntityMode entityMode; - public ExampleTreeWalker(Session session) { sessionFactory = session.getSessionFactory(); - entityMode = session.getEntityMode(); } public Criteria walk(Criteria rootCriteria) @@ -281,7 +277,7 @@ continue; } - Object propertyValue = classMetadata.getPropertyValue(entity, propertyName, entityMode); + Object propertyValue = classMetadata.getPropertyValue(entity, propertyName); if (propertyType.isCollectionType()) { propertyValue = ExampleTreeUtils.getValueFromCollection(propertyValue); Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTreeUtils.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTreeUtils.java 2012-07-05 14:55:25 UTC (rev 4093) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/ExampleTreeUtils.java 2012-07-05 15:03:58 UTC (rev 4094) @@ -33,7 +33,7 @@ import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.criterion.Restrictions; -import org.hibernate.engine.SessionImplementor; +import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.metadata.ClassMetadata; Modified: trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java 2012-07-05 14:55:25 UTC (rev 4093) +++ trunk/openutils-bshd5/src/main/java/it/openutils/hibernate/example/FilterMetadataSupport.java 2012-07-05 15:03:58 UTC (rev 4094) @@ -33,7 +33,6 @@ import java.util.Set; import org.hibernate.Criteria; -import org.hibernate.EntityMode; import org.hibernate.Hibernate; import org.hibernate.Session; import org.hibernate.SessionFactory; @@ -96,12 +95,9 @@ private final SessionFactory sessionFactory; - private final EntityMode entityMode; - public ExampleTreeWalker(Session session) { sessionFactory = session.getSessionFactory(); - entityMode = session.getEntityMode(); } public Criteria walk(Criteria rootCriteria, Object rootEntity) @@ -128,7 +124,7 @@ { continue; } - Object propertyValue = classMetadata.getPropertyValue(entity, propertyName, entityMode); + Object propertyValue = classMetadata.getPropertyValue(entity, propertyName); FilterMetadata fm = currFilterMetadata.get(propertyName); if (fm != null && propertyValue != null) { Modified: trunk/openutils-bshd5/src/test/resources/hibernate.cfg.xml =================================================================== --- trunk/openutils-bshd5/src/test/resources/hibernate.cfg.xml 2012-07-05 14:55:25 UTC (rev 4093) +++ trunk/openutils-bshd5/src/test/resources/hibernate.cfg.xml 2012-07-05 15:03:58 UTC (rev 4094) @@ -1,6 +1,6 @@ <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" - "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> + "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <mapping class="it.openutils.hibernate.test.model.Address" /> Modified: trunk/openutils-bshd5/src/test/resources/spring-tests.xml =================================================================== --- trunk/openutils-bshd5/src/test/resources/spring-tests.xml 2012-07-05 14:55:25 UTC (rev 4093) +++ trunk/openutils-bshd5/src/test/resources/spring-tests.xml 2012-07-05 15:03:58 UTC (rev 4094) @@ -3,11 +3,11 @@ xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop - http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-2.5.xsd"> + http://www.springframework.org/schema/context/spring-context-3.1.xsd"> <context:annotation-config /> <context:component-scan base-package="it.openutils.hibernate.test" /> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> @@ -16,10 +16,9 @@ <property name="username" value="${hibernate.user}" /> <property name="password" value="${hibernate.password}" /> </bean> - <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> + <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="classpath:hibernate.cfg.xml" /> - <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" /> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> @@ -28,7 +27,7 @@ </props> </property> </bean> - <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> + <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> </beans> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gca...@us...> - 2014-07-04 14:43:38
|
Revision: 4577 http://openutils.svn.sourceforge.net/openutils/?rev=4577&view=rev Author: gcatania Date: 2014-07-04 14:43:33 +0000 (Fri, 04 Jul 2014) Log Message: ----------- BSHD-24 dependency updates Modified Paths: -------------- trunk/openutils-bshd5/pom.xml trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java trunk/openutils-bshd5/src/test/resources/spring-tests.xml Modified: trunk/openutils-bshd5/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2014-07-04 14:12:17 UTC (rev 4576) +++ trunk/openutils-bshd5/pom.xml 2014-07-04 14:43:33 UTC (rev 4577) @@ -64,7 +64,7 @@ <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> - <version>2.3.7</version> + <version>2.5.0</version> <extensions>true</extensions> </plugin> </plugins> @@ -122,14 +122,14 @@ </exclusions> </dependency> <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>3.2.1</version> + <groupId>org.apache.commons</groupId> + <artifactId>commons-collections4</artifactId> + <version>4.0</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> - <version>3.1</version> + <version>3.3.2</version> </dependency> <dependency> <groupId>org.javassist</groupId> @@ -138,10 +138,16 @@ </dependency> <!-- test dependencies --> <dependency> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - <version>1.2.1</version> + <groupId>org.apache.commons</groupId> + <artifactId>commons-dbcp2</artifactId> + <version>2.0.1</version> <scope>test</scope> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> @@ -170,15 +176,15 @@ <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> - <version>6.5.2</version> + <version>6.8.8</version> <scope>test</scope> </dependency> </dependencies> <properties> - <slf4j.version>1.7.5</slf4j.version> - <hibernate.version>4.1.10.Final</hibernate.version> - <javassist.version>3.17.1-GA</javassist.version> - <spring.version>3.2.1.RELEASE</spring.version> + <slf4j.version>1.7.7</slf4j.version> + <hibernate.version>4.3.5.Final</hibernate.version> + <javassist.version>3.18.2-GA</javassist.version> + <spring.version>4.0.5.RELEASE</spring.version> </properties> <profiles> Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2014-07-04 14:12:17 UTC (rev 4576) +++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2014-07-04 14:43:33 UTC (rev 4577) @@ -34,8 +34,8 @@ import java.util.Map; import org.aopalliance.aop.AspectException; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.MapUtils; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.hibernate.Criteria; import org.hibernate.Hibernate; Modified: trunk/openutils-bshd5/src/test/resources/spring-tests.xml =================================================================== --- trunk/openutils-bshd5/src/test/resources/spring-tests.xml 2014-07-04 14:12:17 UTC (rev 4576) +++ trunk/openutils-bshd5/src/test/resources/spring-tests.xml 2014-07-04 14:43:33 UTC (rev 4577) @@ -10,7 +10,7 @@ http://www.springframework.org/schema/context/spring-context-3.1.xsd"> <context:annotation-config /> <context:component-scan base-package="it.openutils.hibernate.test" /> - <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> + <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${hibernate.driver}" /> <property name="url" value="${hibernate.url}" /> <property name="username" value="${hibernate.user}" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gca...@us...> - 2014-08-01 17:09:45
|
Revision: 4587 http://openutils.svn.sourceforge.net/openutils/?rev=4587&view=rev Author: gcatania Date: 2014-08-01 17:09:42 +0000 (Fri, 01 Aug 2014) Log Message: ----------- BSHD-26 improve test coverage Modified Paths: -------------- trunk/openutils-bshd5/pom.xml Added Paths: ----------- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/example/ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/example/ExampleTreeUtilsTest.java Modified: trunk/openutils-bshd5/pom.xml =================================================================== --- trunk/openutils-bshd5/pom.xml 2014-08-01 17:03:08 UTC (rev 4586) +++ trunk/openutils-bshd5/pom.xml 2014-08-01 17:09:42 UTC (rev 4587) @@ -179,6 +179,12 @@ <version>6.8.8</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <version>1.9.5</version> + <scope>test</scope> + </dependency> </dependencies> <properties> <slf4j.version>1.7.7</slf4j.version> Added: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/example/ExampleTreeUtilsTest.java =================================================================== --- trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/example/ExampleTreeUtilsTest.java (rev 0) +++ trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/example/ExampleTreeUtilsTest.java 2014-08-01 17:09:42 UTC (rev 4587) @@ -0,0 +1,195 @@ +/** + * Copyright (c) Energeya LLC. All rights reserved. http://www.energeya.com + */ +package it.openutils.hibernate.example; + +import static it.openutils.hibernate.example.ExampleTreeUtils.addIdentifierRestriction; +import static it.openutils.hibernate.example.ExampleTreeUtils.alreadyWalked; +import static it.openutils.hibernate.example.ExampleTreeUtils.append; +import static it.openutils.hibernate.example.ExampleTreeUtils.getClassMetadata; +import static it.openutils.hibernate.example.ExampleTreeUtils.getPath; +import static it.openutils.hibernate.example.ExampleTreeUtils.getValueFromCollection; +import static org.mockito.Matchers.argThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; + +import org.apache.commons.lang3.StringUtils; +import org.hamcrest.Matcher; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Restrictions; +import org.hibernate.event.spi.EventSource; +import org.hibernate.metadata.ClassMetadata; +import org.mockito.ArgumentMatcher; +import org.testng.Assert; +import org.testng.annotations.Test; + + +/** + * @author gcatania + * @version $Id$ + */ +public class ExampleTreeUtilsTest +{ + + @Test + public void testAlreadyWalked() + { + Assert.assertFalse(alreadyWalked(new String[0], "prop")); + Assert.assertFalse(alreadyWalked(new String[]{"prop" }, "prop")); + Assert.assertFalse(alreadyWalked(new String[]{"prop", "childProp" }, "childProp")); + Assert.assertFalse(alreadyWalked(new String[]{"prop", "childProp", "grandchildProp" }, "childProp")); + Assert.assertFalse(alreadyWalked(new String[]{"prop", "childProp", "grandchildProp" }, "grandchildProp")); + Assert.assertFalse(alreadyWalked(new String[]{"prop", "childProp", "parentProp" }, "childProp")); + Assert.assertFalse(alreadyWalked(new String[]{"prop", "childProp", "parentProp", "childProp" }, "childProp")); + Assert.assertFalse(alreadyWalked(new String[]{"a", "b", "c", "b" }, "b")); + Assert.assertTrue(alreadyWalked(new String[]{"a", "b", "a", "b" }, "a")); + } + + @Test + public void testGetValueFromColl() + { + Assert.assertNull(getValueFromCollection("prop", null)); + Assert.assertNull(getValueFromCollection("prop", Collections.emptySet())); + Assert.assertNull(getValueFromCollection("prop", Collections.emptyList())); + Assert.assertNull(getValueFromCollection("prop", new Object[0])); + Assert.assertNull(getValueFromCollection("prop", new double[0])); + + Object singleResult = new Object(); + Assert.assertEquals(getValueFromCollection("prop", Collections.singleton(singleResult)), singleResult); + Assert.assertEquals(getValueFromCollection("prop", Collections.singletonList(singleResult)), singleResult); + Assert.assertEquals(getValueFromCollection("prop", new Object[]{singleResult }), singleResult); + Assert.assertEquals(getValueFromCollection("prop", new double[]{3d }), 3d); + + try + { + getValueFromCollection("wasabi", Arrays.asList("a", "b")); + Assert.fail("Should have thrown exception"); + } + catch (IllegalArgumentException e) + { + Assert.assertTrue(e.getMessage().contains("wasabi"), "exception message did not report property name.\n" + + e.getMessage()); + } + try + { + getValueFromCollection("wasabi", new String[]{"a", "b" }); + Assert.fail("Should have thrown exception"); + } + catch (IllegalArgumentException e) + { + Assert.assertTrue(e.getMessage().contains("wasabi"), "exception message did not report property name.\n" + + e.getMessage()); + } + } + + @Test + public void testGetClassMetadata() + { + SessionFactory sess = mock(SessionFactory.class); + ClassMetadata clm = mock(ClassMetadata.class); + when(sess.getClassMetadata(String.class)).thenReturn(clm); + + ClassMetadata returned = getClassMetadata("pippo", sess); + Assert.assertEquals(returned, clm); + } + + @Test + public void testGetClassMetadataNotFound() + { + SessionFactory sess = mock(SessionFactory.class); + when(sess.getClassMetadata(String.class)).thenReturn(null); + + try + { + getClassMetadata("pippo", sess); + Assert.fail("Should have thrown exception"); + } + catch (IllegalStateException e) + { + Assert.assertTrue( + e.getMessage().contains(String.class.toString()), + "exception message did not report entity type.\n" + e.getMessage()); + } + } + + @Test + public void testAppend() + { + Assert.assertEquals(append(new String[0], "a"), new String[]{"a" }); + Assert.assertEquals(append(new String[]{"a" }, "b"), new String[]{"a", "b" }); + Assert.assertEquals(append(new String[]{null }, null), new String[]{null, null }); + } + + @Test + public void testGetPath() + { + Assert.assertEquals(getPath(new String[0]), StringUtils.EMPTY); + Assert.assertEquals(getPath(new String[]{"pippo" }), "pippo"); + Assert.assertEquals(getPath(new String[]{"a", "b" }), "a.b"); + Assert.assertEquals(getPath(new String[]{"a", "b", "c" }), "a.b.c"); + } + + @Test + public void testAddIdentifierRestrictionWhenAdded() + { + Criteria crit = mock(Criteria.class); + Object entity = new Object(); + // mock EventSource because it needs to implement both Session and SessionImplementor + EventSource sess = mock(EventSource.class); + ClassMetadata clm = mock(ClassMetadata.class); + when(clm.getIdentifierPropertyName()).thenReturn("id"); + when(clm.getIdentifier(entity, sess)).thenReturn(1); + + boolean added = addIdentifierRestriction(crit, entity, clm, sess); + Assert.assertTrue(added, "identifier restriction not added"); + + Matcher<Criterion> hasSameToStringAsIdEqualsOneRestriction = new ArgumentMatcher<Criterion>() + { + + @Override + public boolean matches(Object argument) + { + // all this mess because Restriction does not support equals + return argument != null && Restrictions.idEq(1).toString().equals(argument.toString()); + } + + }; + verify(crit).add(argThat(hasSameToStringAsIdEqualsOneRestriction)); + } + + @Test + public void testAddIdentifierRestrictionWhenNotAdded1() + { + Criteria crit = mock(Criteria.class); + Object entity = new Object(); + // mock EventSource because it needs to implement both Session and SessionImplementor + EventSource sess = mock(EventSource.class); + ClassMetadata clm = mock(ClassMetadata.class); + when(clm.getIdentifierPropertyName()).thenReturn(null); + + boolean added = addIdentifierRestriction(crit, entity, clm, sess); + Assert.assertFalse(added, "identifier restriction added"); + } + + @Test + public void testAddIdentifierRestrictionWhenNotAdded2() + { + Criteria crit = mock(Criteria.class); + Object entity = new Object(); + // mock EventSource because it needs to implement both Session and SessionImplementor + EventSource sess = mock(EventSource.class); + ClassMetadata clm = mock(ClassMetadata.class); + when(clm.getIdentifierPropertyName()).thenReturn("id"); + when(clm.getIdentifier(entity, sess)).thenReturn(null); + + boolean added = addIdentifierRestriction(crit, entity, clm, sess); + Assert.assertFalse(added, "identifier restriction added"); + } + +} Property changes on: trunk/openutils-bshd5/src/test/java/it/openutils/hibernate/example/ExampleTreeUtilsTest.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |