1
0
Fork 0
This commit is contained in:
Ziedelth 2022-06-29 20:33:43 +02:00
parent 78fc588327
commit d4c8826056
55 changed files with 913 additions and 813 deletions

10
.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Zeppelin ignored files
/ZeppelinRemoteNotebooks/

6
.idea/jpa-buddy.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaBuddyIdeaProjectConfig">
<option name="defaultUnitInitialized" value="true" />
</component>
</project>

View file

@ -0,0 +1,15 @@
<component name="libraryTable">
<library name="Java EE 6-Java EE 6">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/javax.annotation.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/javax.jms.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/javax.resource.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/javax.ejb.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/javax.servlet.jsp.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/javax.servlet.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/javax.persistence.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

51
.idea/libraries/lib.xml Normal file
View file

@ -0,0 +1,51 @@
<component name="libraryTable">
<library name="lib">
<CLASSES>
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-context-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/jboss-logging-3.1.3.GA.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-struts-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-jms-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-webmvc-portlet-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/javassist-3.18.1-GA.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-core-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-webmvc-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/jboss-transaction-api_1.2_spec-1.0.0.Final.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/jstl-api.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/hibernate-ehcache-4.3.1.Final.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-jdbc-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/hibernate-entitymanager-4.3.1.Final.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-instrument-tomcat-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/hibernate-c3p0-4.3.1.Final.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-context-support-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/ehcache-core-2.4.3.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/mchange-commons-java-0.2.3.4.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/slf4j-api-1.6.1.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-web-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/slf4j-simple-1.6.1.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-framework-bom-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/hibernate-core-4.3.1.Final.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/c3p0-0.9.2.1.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-aspects-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-expression-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/dom4j-1.6.1.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-build-src-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/hibernate-commons-annotations-4.0.4.Final.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-tx-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/org-apache-commons-logging.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-beans-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-test-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/antlr-2.7.7.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-aop-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/cglib-2.2.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-orm-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-instrument-3.2.7.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-web-3.2.18.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/jstl-impl.jar!/" />
<root url="jar://$PROJECT_DIR$/build/web/WEB-INF/lib/spring-oxm-3.2.7.RELEASE.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.ideaLibSources/hibernate-core-4.3.1.Final-sources.jar!/" />
</SOURCES>
</library>
</component>

12
.idea/misc.xml Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="ProjectType">
<option name="id" value="jpab" />
</component>
</project>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/jee-project.iml" filepath="$PROJECT_DIR$/jee-project.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View file

@ -1,45 +1,45 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.Customer" table="CUSTOMER" schema="APP"> <class name="DAO.Customer" table="CUSTOMER" schema="APP">
<id name="customerId" type="int"> <id name="customerId" type="int">
<column name="CUSTOMER_ID" /> <column name="CUSTOMER_ID"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="discountCode" type="char"> <property name="discountCode" type="char">
<column name="DISCOUNT_CODE" length="1" not-null="true" /> <column name="DISCOUNT_CODE" length="1" not-null="true"/>
</property> </property>
<property name="zip" type="string"> <property name="zip" type="string">
<column name="ZIP" length="10" not-null="true" /> <column name="ZIP" length="10" not-null="true"/>
</property> </property>
<property name="name" type="string"> <property name="name" type="string">
<column name="NAME" length="30" /> <column name="NAME" length="30"/>
</property> </property>
<property name="addressline1" type="string"> <property name="addressline1" type="string">
<column name="ADDRESSLINE1" length="30" /> <column name="ADDRESSLINE1" length="30"/>
</property> </property>
<property name="addressline2" type="string"> <property name="addressline2" type="string">
<column name="ADDRESSLINE2" length="30" /> <column name="ADDRESSLINE2" length="30"/>
</property> </property>
<property name="city" type="string"> <property name="city" type="string">
<column name="CITY" length="25" /> <column name="CITY" length="25"/>
</property> </property>
<property name="state" type="string"> <property name="state" type="string">
<column name="STATE" length="2" /> <column name="STATE" length="2"/>
</property> </property>
<property name="phone" type="string"> <property name="phone" type="string">
<column name="PHONE" length="12" /> <column name="PHONE" length="12"/>
</property> </property>
<property name="fax" type="string"> <property name="fax" type="string">
<column name="FAX" length="12" /> <column name="FAX" length="12"/>
</property> </property>
<property name="email" type="string"> <property name="email" type="string">
<column name="EMAIL" length="40" /> <column name="EMAIL" length="40"/>
</property> </property>
<property name="creditLimit" type="java.lang.Integer"> <property name="creditLimit" type="java.lang.Integer">
<column name="CREDIT_LIMIT" /> <column name="CREDIT_LIMIT"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -1,15 +1,15 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.DiscountCode" table="DISCOUNT_CODE" schema="APP"> <class name="DAO.DiscountCode" table="DISCOUNT_CODE" schema="APP">
<id name="discountCode" type="char"> <id name="discountCode" type="char">
<column name="DISCOUNT_CODE" length="1" /> <column name="DISCOUNT_CODE" length="1"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="rate" type="big_decimal"> <property name="rate" type="big_decimal">
<column name="RATE" precision="4" /> <column name="RATE" precision="4"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -1,42 +1,42 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.Manufacturer" table="MANUFACTURER" schema="APP"> <class name="DAO.Manufacturer" table="MANUFACTURER" schema="APP">
<id name="manufacturerId" type="int"> <id name="manufacturerId" type="int">
<column name="MANUFACTURER_ID" /> <column name="MANUFACTURER_ID"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="name" type="string"> <property name="name" type="string">
<column name="NAME" length="30" /> <column name="NAME" length="30"/>
</property> </property>
<property name="addressline1" type="string"> <property name="addressline1" type="string">
<column name="ADDRESSLINE1" length="30" /> <column name="ADDRESSLINE1" length="30"/>
</property> </property>
<property name="addressline2" type="string"> <property name="addressline2" type="string">
<column name="ADDRESSLINE2" length="30" /> <column name="ADDRESSLINE2" length="30"/>
</property> </property>
<property name="city" type="string"> <property name="city" type="string">
<column name="CITY" length="25" /> <column name="CITY" length="25"/>
</property> </property>
<property name="state" type="string"> <property name="state" type="string">
<column name="STATE" length="2" /> <column name="STATE" length="2"/>
</property> </property>
<property name="zip" type="string"> <property name="zip" type="string">
<column name="ZIP" length="10" /> <column name="ZIP" length="10"/>
</property> </property>
<property name="phone" type="string"> <property name="phone" type="string">
<column name="PHONE" length="12" /> <column name="PHONE" length="12"/>
</property> </property>
<property name="fax" type="string"> <property name="fax" type="string">
<column name="FAX" length="12" /> <column name="FAX" length="12"/>
</property> </property>
<property name="email" type="string"> <property name="email" type="string">
<column name="EMAIL" length="40" /> <column name="EMAIL" length="40"/>
</property> </property>
<property name="rep" type="string"> <property name="rep" type="string">
<column name="REP" length="30" /> <column name="REP" length="30"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -1,21 +1,21 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.MicroMarket" table="MICRO_MARKET" schema="APP"> <class name="DAO.MicroMarket" table="MICRO_MARKET" schema="APP">
<id name="zipCode" type="string"> <id name="zipCode" type="string">
<column name="ZIP_CODE" length="10" /> <column name="ZIP_CODE" length="10"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="radius" type="java.lang.Double"> <property name="radius" type="java.lang.Double">
<column name="RADIUS" precision="52" scale="0" /> <column name="RADIUS" precision="52" scale="0"/>
</property> </property>
<property name="areaLength" type="java.lang.Double"> <property name="areaLength" type="java.lang.Double">
<column name="AREA_LENGTH" precision="52" scale="0" /> <column name="AREA_LENGTH" precision="52" scale="0"/>
</property> </property>
<property name="areaWidth" type="java.lang.Double"> <property name="areaWidth" type="java.lang.Double">
<column name="AREA_WIDTH" precision="52" scale="0" /> <column name="AREA_WIDTH" precision="52" scale="0"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -1,33 +1,33 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.Product" table="PRODUCT" schema="APP"> <class name="DAO.Product" table="PRODUCT" schema="APP">
<id name="productId" type="int"> <id name="productId" type="int">
<column name="PRODUCT_ID" /> <column name="PRODUCT_ID"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="manufacturerId" type="int"> <property name="manufacturerId" type="int">
<column name="MANUFACTURER_ID" not-null="true" /> <column name="MANUFACTURER_ID" not-null="true"/>
</property> </property>
<property name="productCode" type="string"> <property name="productCode" type="string">
<column name="PRODUCT_CODE" length="2" not-null="true" /> <column name="PRODUCT_CODE" length="2" not-null="true"/>
</property> </property>
<property name="purchaseCost" type="big_decimal"> <property name="purchaseCost" type="big_decimal">
<column name="PURCHASE_COST" precision="12" /> <column name="PURCHASE_COST" precision="12"/>
</property> </property>
<property name="quantityOnHand" type="java.lang.Integer"> <property name="quantityOnHand" type="java.lang.Integer">
<column name="QUANTITY_ON_HAND" /> <column name="QUANTITY_ON_HAND"/>
</property> </property>
<property name="markup" type="big_decimal"> <property name="markup" type="big_decimal">
<column name="MARKUP" precision="4" /> <column name="MARKUP" precision="4"/>
</property> </property>
<property name="available" type="string"> <property name="available" type="string">
<column name="AVAILABLE" length="5" /> <column name="AVAILABLE" length="5"/>
</property> </property>
<property name="description" type="string"> <property name="description" type="string">
<column name="DESCRIPTION" length="50" /> <column name="DESCRIPTION" length="50"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -1,18 +1,18 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.ProductCode" table="PRODUCT_CODE" schema="APP"> <class name="DAO.ProductCode" table="PRODUCT_CODE" schema="APP">
<id name="prodCode" type="string"> <id name="prodCode" type="string">
<column name="PROD_CODE" length="2" /> <column name="PROD_CODE" length="2"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="discountCode" type="char"> <property name="discountCode" type="char">
<column name="DISCOUNT_CODE" length="1" not-null="true" /> <column name="DISCOUNT_CODE" length="1" not-null="true"/>
</property> </property>
<property name="description" type="string"> <property name="description" type="string">
<column name="DESCRIPTION" length="10" /> <column name="DESCRIPTION" length="10"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -1,33 +1,33 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.PurchaseOrder" table="PURCHASE_ORDER" schema="APP"> <class name="DAO.PurchaseOrder" table="PURCHASE_ORDER" schema="APP">
<id name="orderNum" type="int"> <id name="orderNum" type="int">
<column name="ORDER_NUM" /> <column name="ORDER_NUM"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="customerId" type="int"> <property name="customerId" type="int">
<column name="CUSTOMER_ID" not-null="true" /> <column name="CUSTOMER_ID" not-null="true"/>
</property> </property>
<property name="productId" type="int"> <property name="productId" type="int">
<column name="PRODUCT_ID" not-null="true" /> <column name="PRODUCT_ID" not-null="true"/>
</property> </property>
<property name="quantity" type="java.lang.Short"> <property name="quantity" type="java.lang.Short">
<column name="QUANTITY" /> <column name="QUANTITY"/>
</property> </property>
<property name="shippingCost" type="big_decimal"> <property name="shippingCost" type="big_decimal">
<column name="SHIPPING_COST" precision="12" /> <column name="SHIPPING_COST" precision="12"/>
</property> </property>
<property name="salesDate" type="date"> <property name="salesDate" type="date">
<column name="SALES_DATE" length="10" /> <column name="SALES_DATE" length="10"/>
</property> </property>
<property name="shippingDate" type="date"> <property name="shippingDate" type="date">
<column name="SHIPPING_DATE" length="10" /> <column name="SHIPPING_DATE" length="10"/>
</property> </property>
<property name="freightCompany" type="string"> <property name="freightCompany" type="string">
<column name="FREIGHT_COMPANY" length="30" /> <column name="FREIGHT_COMPANY" length="30"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration> <hibernate-configuration>
<session-factory> <session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property> <property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="hibernate.connection.driver_class">org.apache.derby.jdbc.ClientDriver</property> <property name="hibernate.connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
<property name="hibernate.connection.url">jdbc:derby://localhost:1527/sample</property> <property name="hibernate.connection.url">jdbc:derby://localhost:1527/sample</property>
<property name="hibernate.connection.username">app</property> <property name="hibernate.connection.username">app</property>
<property name="hibernate.connection.password">app</property> <property name="hibernate.connection.password">app</property>
<mapping resource="DAO/DiscountCode.hbm.xml"/> <mapping resource="DAO/DiscountCode.hbm.xml"/>
<mapping resource="DAO/Product.hbm.xml"/> <mapping resource="DAO/Product.hbm.xml"/>
<mapping resource="DAO/PurchaseOrder.hbm.xml"/> <mapping resource="DAO/PurchaseOrder.hbm.xml"/>
<mapping resource="DAO/Manufacturer.hbm.xml"/> <mapping resource="DAO/Manufacturer.hbm.xml"/>
<mapping resource="DAO/MicroMarket.hbm.xml"/> <mapping resource="DAO/MicroMarket.hbm.xml"/>
<mapping resource="DAO/Customer.hbm.xml"/> <mapping resource="DAO/Customer.hbm.xml"/>
<mapping resource="DAO/ProductCode.hbm.xml"/> <mapping resource="DAO/ProductCode.hbm.xml"/>
</session-factory> </session-factory>
</hibernate-configuration> </hibernate-configuration>

View file

@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"> <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
<hibernate-reverse-engineering> <hibernate-reverse-engineering>
<schema-selection match-schema="APP"/> <schema-selection match-schema="APP"/>
<table-filter match-name="MANUFACTURER"/> <table-filter match-name="MANUFACTURER"/>
<table-filter match-name="PRODUCT"/> <table-filter match-name="PRODUCT"/>
<table-filter match-name="DISCOUNT_CODE"/> <table-filter match-name="DISCOUNT_CODE"/>
<table-filter match-name="PRODUCT_CODE"/> <table-filter match-name="PRODUCT_CODE"/>
<table-filter match-name="MICRO_MARKET"/> <table-filter match-name="MICRO_MARKET"/>
<table-filter match-name="PURCHASE_ORDER"/> <table-filter match-name="PURCHASE_ORDER"/>
<table-filter match-name="CUSTOMER"/> <table-filter match-name="CUSTOMER"/>
</hibernate-reverse-engineering> </hibernate-reverse-engineering>

13
jee-project.iml Normal file
View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lib" level="project" />
<orderEntry type="library" name="Java EE 6-Java EE 6" level="project" />
</component>
</module>

BIN
lib/javax.annotation.jar Normal file

Binary file not shown.

BIN
lib/javax.ejb.jar Normal file

Binary file not shown.

BIN
lib/javax.jms.jar Normal file

Binary file not shown.

BIN
lib/javax.persistence.jar Normal file

Binary file not shown.

BIN
lib/javax.resource.jar Normal file

Binary file not shown.

BIN
lib/javax.servlet.jar Normal file

Binary file not shown.

BIN
lib/javax.servlet.jsp.jar Normal file

Binary file not shown.

View file

@ -1,45 +1,45 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.Customer" table="CUSTOMER" schema="APP"> <class name="DAO.Customer" table="CUSTOMER" schema="APP">
<id name="customerId" type="int"> <id name="customerId" type="int">
<column name="CUSTOMER_ID" /> <column name="CUSTOMER_ID"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="discountCode" type="char"> <property name="discountCode" type="char">
<column name="DISCOUNT_CODE" length="1" not-null="true" /> <column name="DISCOUNT_CODE" length="1" not-null="true"/>
</property> </property>
<property name="zip" type="string"> <property name="zip" type="string">
<column name="ZIP" length="10" not-null="true" /> <column name="ZIP" length="10" not-null="true"/>
</property> </property>
<property name="name" type="string"> <property name="name" type="string">
<column name="NAME" length="30" /> <column name="NAME" length="30"/>
</property> </property>
<property name="addressline1" type="string"> <property name="addressline1" type="string">
<column name="ADDRESSLINE1" length="30" /> <column name="ADDRESSLINE1" length="30"/>
</property> </property>
<property name="addressline2" type="string"> <property name="addressline2" type="string">
<column name="ADDRESSLINE2" length="30" /> <column name="ADDRESSLINE2" length="30"/>
</property> </property>
<property name="city" type="string"> <property name="city" type="string">
<column name="CITY" length="25" /> <column name="CITY" length="25"/>
</property> </property>
<property name="state" type="string"> <property name="state" type="string">
<column name="STATE" length="2" /> <column name="STATE" length="2"/>
</property> </property>
<property name="phone" type="string"> <property name="phone" type="string">
<column name="PHONE" length="12" /> <column name="PHONE" length="12"/>
</property> </property>
<property name="fax" type="string"> <property name="fax" type="string">
<column name="FAX" length="12" /> <column name="FAX" length="12"/>
</property> </property>
<property name="email" type="string"> <property name="email" type="string">
<column name="EMAIL" length="40" /> <column name="EMAIL" length="40"/>
</property> </property>
<property name="creditLimit" type="java.lang.Integer"> <property name="creditLimit" type="java.lang.Integer">
<column name="CREDIT_LIMIT" /> <column name="CREDIT_LIMIT"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -2,148 +2,157 @@ package DAO;
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1 // Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
/** /**
* Customer generated by hbm2java * Customer generated by hbm2java
*/ */
public class Customer implements java.io.Serializable { public class Customer implements java.io.Serializable {
private int customerId; private int customerId;
private char discountCode; private char discountCode;
private String zip; private String zip;
private String name; private String name;
private String addressline1; private String addressline1;
private String addressline2; private String addressline2;
private String city; private String city;
private String state; private String state;
private String phone; private String phone;
private String fax; private String fax;
private String email; private String email;
private Integer creditLimit; private Integer creditLimit;
public Customer() { public Customer() {
} }
public Customer(int customerId, char discountCode, String zip) { public Customer(int customerId, char discountCode, String zip) {
this.customerId = customerId; this.customerId = customerId;
this.discountCode = discountCode; this.discountCode = discountCode;
this.zip = zip; this.zip = zip;
} }
public Customer(int customerId, char discountCode,String _name, String _adress, String _phone,String _email, String _zip) {
public Customer(int customerId, char discountCode, String _name, String _adress, String _phone, String _email, String _zip) {
this.customerId = customerId; this.customerId = customerId;
this.discountCode = discountCode; this.discountCode = discountCode;
this.name=_name; this.name = _name;
this.addressline1=_adress; this.addressline1 = _adress;
this.phone=_phone; this.phone = _phone;
this.email=_email; this.email = _email;
this.zip = _zip; this.zip = _zip;
} }
public Customer(int customerId, char discountCode, String zip, String name, String addressline1, String addressline2, String city, String state, String phone, String fax, String email, Integer creditLimit) { public Customer(int customerId, char discountCode, String zip, String name, String addressline1, String addressline2, String city, String state, String phone, String fax, String email, Integer creditLimit) {
this.customerId = customerId; this.customerId = customerId;
this.discountCode = discountCode; this.discountCode = discountCode;
this.zip = zip; this.zip = zip;
this.name = name; this.name = name;
this.addressline1 = addressline1; this.addressline1 = addressline1;
this.addressline2 = addressline2; this.addressline2 = addressline2;
this.city = city; this.city = city;
this.state = state; this.state = state;
this.phone = phone; this.phone = phone;
this.fax = fax; this.fax = fax;
this.email = email; this.email = email;
this.creditLimit = creditLimit; this.creditLimit = creditLimit;
} }
public int getCustomerId() { public int getCustomerId() {
return this.customerId; return this.customerId;
} }
public void setCustomerId(int customerId) { public void setCustomerId(int customerId) {
this.customerId = customerId; this.customerId = customerId;
} }
public char getDiscountCode() { public char getDiscountCode() {
return this.discountCode; return this.discountCode;
} }
public void setDiscountCode(char discountCode) { public void setDiscountCode(char discountCode) {
this.discountCode = discountCode; this.discountCode = discountCode;
} }
public String getZip() { public String getZip() {
return this.zip; return this.zip;
} }
public void setZip(String zip) { public void setZip(String zip) {
this.zip = zip; this.zip = zip;
} }
public String getName() { public String getName() {
return this.name; return this.name;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String getAddressline1() { public String getAddressline1() {
return this.addressline1; return this.addressline1;
} }
public void setAddressline1(String addressline1) { public void setAddressline1(String addressline1) {
this.addressline1 = addressline1; this.addressline1 = addressline1;
} }
public String getAddressline2() { public String getAddressline2() {
return this.addressline2; return this.addressline2;
} }
public void setAddressline2(String addressline2) { public void setAddressline2(String addressline2) {
this.addressline2 = addressline2; this.addressline2 = addressline2;
} }
public String getCity() { public String getCity() {
return this.city; return this.city;
} }
public void setCity(String city) { public void setCity(String city) {
this.city = city; this.city = city;
} }
public String getState() { public String getState() {
return this.state; return this.state;
} }
public void setState(String state) { public void setState(String state) {
this.state = state; this.state = state;
} }
public String getPhone() { public String getPhone() {
return this.phone; return this.phone;
} }
public void setPhone(String phone) { public void setPhone(String phone) {
this.phone = phone; this.phone = phone;
} }
public String getFax() { public String getFax() {
return this.fax; return this.fax;
} }
public void setFax(String fax) { public void setFax(String fax) {
this.fax = fax; this.fax = fax;
} }
public String getEmail() { public String getEmail() {
return this.email; return this.email;
} }
public void setEmail(String email) { public void setEmail(String email) {
this.email = email; this.email = email;
} }
public Integer getCreditLimit() { public Integer getCreditLimit() {
return this.creditLimit; return this.creditLimit;
} }
public void setCreditLimit(Integer creditLimit) { public void setCreditLimit(Integer creditLimit) {
this.creditLimit = creditLimit; this.creditLimit = creditLimit;
} }
} }

View file

@ -1,15 +1,15 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.DiscountCode" table="DISCOUNT_CODE" schema="APP"> <class name="DAO.DiscountCode" table="DISCOUNT_CODE" schema="APP">
<id name="discountCode" type="char"> <id name="discountCode" type="char">
<column name="DISCOUNT_CODE" length="1" /> <column name="DISCOUNT_CODE" length="1"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="rate" type="big_decimal"> <property name="rate" type="big_decimal">
<column name="RATE" precision="4" /> <column name="RATE" precision="4"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -7,42 +7,42 @@ import java.math.BigDecimal;
/** /**
* DiscountCode generated by hbm2java * DiscountCode generated by hbm2java
*/ */
public class DiscountCode implements java.io.Serializable { public class DiscountCode implements java.io.Serializable {
private char discountCode; private char discountCode;
private BigDecimal rate; private BigDecimal rate;
public DiscountCode() { public DiscountCode() {
} }
public DiscountCode(char discountCode) { public DiscountCode(char discountCode) {
this.discountCode = discountCode; this.discountCode = discountCode;
} }
public DiscountCode(char discountCode, BigDecimal rate) { public DiscountCode(char discountCode, BigDecimal rate) {
this.discountCode = discountCode; this.discountCode = discountCode;
this.rate = rate; this.rate = rate;
} }
public char getDiscountCode() { public char getDiscountCode() {
return this.discountCode; return this.discountCode;
} }
public void setDiscountCode(char discountCode) { public void setDiscountCode(char discountCode) {
this.discountCode = discountCode; this.discountCode = discountCode;
} }
public BigDecimal getRate() { public BigDecimal getRate() {
return this.rate; return this.rate;
} }
public void setRate(BigDecimal rate) { public void setRate(BigDecimal rate) {
this.rate = rate; this.rate = rate;
} }
} }

View file

@ -5,8 +5,8 @@
*/ */
package DAO; package DAO;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
/** /**
@ -18,21 +18,21 @@ import org.hibernate.SessionFactory;
public class HibernateUtil { public class HibernateUtil {
private static final SessionFactory sessionFactory; private static final SessionFactory sessionFactory;
static { static {
try { try {
// Create the SessionFactory from standard (hibernate.cfg.xml) // Create the SessionFactory from standard (hibernate.cfg.xml)
// config file. // config file.
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory(); sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
} catch (Throwable ex) { } catch (Throwable ex) {
// Log the exception. // Log the exception.
System.err.println("Initial SessionFactory creation failed." + ex); System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex); throw new ExceptionInInitializerError(ex);
} }
} }
public static SessionFactory getSessionFactory() { public static SessionFactory getSessionFactory() {
return sessionFactory; return sessionFactory;
} }

View file

@ -4,339 +4,306 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
package DAO; package DAO;
import org.hibernate.*;
import org.hibernate.cfg.Configuration; import org.hibernate.Query;
import java.util.*; import org.hibernate.Session;
import java.sql.*; import org.hibernate.Transaction;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author faycal * @author faycal
*/ */
public class MagasinHelper { public class MagasinHelper {
Session session = null; Session session;
List<String> colonnes = new ArrayList<String>();
public List<String> getColonnes() {
return colonnes;
}
ArrayList <String> colonnes=new ArrayList();
public MagasinHelper() { public MagasinHelper() {
this.session = HibernateUtil.getSessionFactory().openSession(); this.session = HibernateUtil.getSessionFactory().openSession();
} }
public List getProducts(){ public List<String> getColonnes() {
List <Product> resultat=null; return colonnes;
Transaction tx=null; }
try{
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession(); public List<Product> getProducts() {
List<Product> resultat = null;
try {
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
session.flush(); session.flush();
tx=session.beginTransaction(); session.beginTransaction();
Query q=session.createQuery("select p.productId, p.manufacturerId, p.productCode, p.purchaseCost, p.quantityOnHand, p.markup, p.available, p.description from Product p"); Query q = session.createQuery("select p.productId, p.manufacturerId, p.productCode, p.purchaseCost, p.quantityOnHand, p.markup, p.available, p.description from Product p");
resultat=q.list(); resultat = q.list();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally{ } finally {
if (session.isOpen())session.close(); if (session.isOpen()) session.close();
} }
return resultat; return resultat;
} }
public Product getProduct(int id){ public Product getProduct(int id) {
Product resultat=null; Product resultat = null;
Transaction tx=null;
try{ try {
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession(); if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
session.flush(); session.flush();
tx=session.beginTransaction(); session.beginTransaction();
Query q=session.createQuery("from Product p where p.productId = :_id"); Query q = session.createQuery("from Product p where p.productId = :_id");
q.setInteger("_id", id); q.setInteger("_id", id);
resultat=(Product)q.list().iterator().next(); resultat = (Product) q.list().iterator().next();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally{ } finally {
if (session.isOpen())session.close(); if (session.isOpen()) session.close();
} }
return resultat; return resultat;
} }
public List getClients(){
List <Customer> resultat=null;
Transaction tx=null;
try{
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession();
session.flush();
tx=session.beginTransaction();
Query q=session.createQuery("select a.customerId, a.name, a.addressline1,a.addressline2,a.zip,b.rate from Customer a, DiscountCode b where a.discountCode=b.discountCode");
//Query q=session.createQuery("from Customer");
resultat=q.list();
}
catch (Exception e) {
e.printStackTrace();
}
finally{
if (session.isOpen())session.close();
}
return resultat;
}
public List getClients(String name){
List resultat=null;
Transaction tx=null;
try{
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession();
session.flush();
tx=session.beginTransaction();
Query q=session.createQuery("select a.customerId, a.name, a.addressline1,a.addressline2,a.zip,b.rate from Customer a, DiscountCode b where a.discountCode=b.discountCode and a.name like :_name");
//Query q=session.createQuery("from Customer");
q.setString("_name",name);
resultat=q.list();
}
catch (Exception e) {
e.printStackTrace();
}
finally{
if (session.isOpen())session.close();
}
return resultat;
}
public List getDiscountCode(){ public List<Customer> getClients() {
List resultat=null; List<Customer> resultat = null;
Transaction tx=null;
try{
if(!session.isOpen())
session=HibernateUtil.getSessionFactory().openSession();
session.flush();
tx=session.beginTransaction();
Query q=session.createQuery("select a.discountCode from DiscountCode a");
resultat=q.list();
}
catch (Exception e) {
e.printStackTrace();
}
finally{
if (session.isOpen())session.close();
}
return resultat;
try {
} if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
public List getMicroMarket(){
List <MicroMarket> resultat=null;
Transaction tx=null;
try{
//if(!session.isOpen())
session=HibernateUtil.getSessionFactory().openSession();
session.flush(); session.flush();
tx=session.beginTransaction(); session.beginTransaction();
Query q=session.createQuery("from MicroMarket"); Query q = session.createQuery("select a.customerId, a.name, a.addressline1,a.addressline2,a.zip,b.rate from Customer a, DiscountCode b where a.discountCode=b.discountCode");
resultat=q.list(); resultat = q.list();
} } catch (Exception e) {
catch (Exception e) { e.printStackTrace();
e.printStackTrace(); } finally {
} if (session.isOpen()) session.close();
finally{
if (session.isOpen())session.close();
} }
return resultat; return resultat;
} }
public List getZipCode(){
List resultat=null; public List<Customer> getClients(String name) {
Transaction tx=null; List<Customer> resultat = null;
try{
//if(!session.isOpen()) try {
session=HibernateUtil.getSessionFactory().openSession(); if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
session.flush(); session.flush();
tx=session.beginTransaction(); session.beginTransaction();
Query q=session.createQuery("select a.zipCode from MicroMarket a"); Query q = session.createQuery("select a.customerId, a.name, a.addressline1,a.addressline2,a.zip,b.rate from Customer a, DiscountCode b where a.discountCode=b.discountCode and a.name like :_name");
resultat=q.list(); q.setString("_name", name);
} resultat = q.list();
catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} } finally {
finally{ if (session.isOpen()) session.close();
if (session.isOpen())session.close();
} }
return resultat; return resultat;
} }
public void insertCustomer (int _customerId, char _discountCode, String _zip) {
public List<DiscountCode> getDiscountCode() {
Transaction tx=null; List<DiscountCode> resultat = null;
try{
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession(); try {
if (!session.isOpen())
session = HibernateUtil.getSessionFactory().openSession();
session.flush(); session.flush();
tx=session.beginTransaction(); session.beginTransaction();
Customer a =new Customer(_customerId,_discountCode,_zip); Query q = session.createQuery("select a.discountCode from DiscountCode a");
session.save(a); resultat = q.list();
tx.commit(); } catch (Exception e) {
}
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
if (session.isOpen()) session.close();
}
return resultat;
}
public List<MicroMarket> getMicroMarket() {
List<MicroMarket> resultat = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.flush();
session.beginTransaction();
Query q = session.createQuery("from MicroMarket");
resultat = q.list();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (session.isOpen()) session.close();
}
return resultat;
}
public List getZipCode() {
List resultat = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.flush();
session.beginTransaction();
Query q = session.createQuery("select a.zipCode from MicroMarket a");
resultat = q.list();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (session.isOpen()) session.close();
}
return resultat;
}
public void insertCustomer(int _customerId, char _discountCode, String _zip) {
Transaction tx = null;
try {
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
session.flush();
tx = session.beginTransaction();
Customer a = new Customer(_customerId, _discountCode, _zip);
session.save(a);
tx.commit();
} catch (Exception e) {
e.printStackTrace();
assert tx != null;
tx.rollback(); tx.rollback();
throw e; throw e;
} finally {
if (session.isOpen()) session.close();
} }
finally{ }
if (session.isOpen())session.close();
}
}
public void updateCustomer (int _customerId,char _discountCode, String _name, String _adress, String _phone,String _email, String _zip){ public void updateCustomer(int _customerId, char _discountCode, String _name, String _adress, String _phone, String _email, String _zip) {
Transaction tx = null;
Transaction tx=null;
try{ try {
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession(); if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
session.flush(); session.flush();
tx=session.beginTransaction(); tx = session.beginTransaction();
Customer a = new Customer(_customerId, _discountCode, _name, _adress, _phone, _email, _zip);
Customer a =new Customer(_customerId,_discountCode,_name, _adress, _phone,_email, _zip); session.update(a);
tx.commit();
session.update(a); } catch (Exception e) {
tx.commit();
}
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
assert tx != null;
tx.rollback(); tx.rollback();
throw e; throw e;
} finally {
if (session.isOpen()) session.close();
} }
finally{ }
if (session.isOpen())session.close();
}
}
public Customer getClient(int id){
Customer client=null;
Transaction tx=null;
try{
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession();
session.flush();
tx=session.beginTransaction();
Query q=session.createQuery(" from Customer a where a.customerId =:_id");
q.setInteger("_id", id);
client=(Customer)q.list().iterator().next();
}
catch (Exception e) {
e.printStackTrace();
}
finally{
if (session.isOpen())session.close();
}
return client;
}
public void deleteCustomer (int _id) { public Customer getClient(int id) {
Customer client = null;
Transaction tx=null;
try{ try {
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession(); if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
session.flush(); session.flush();
session.beginTransaction();
tx=session.beginTransaction(); Query q = session.createQuery(" from Customer a where a.customerId =:_id");
Query q=session.createQuery(" from Customer a where a.customerId =:_id"); q.setInteger("_id", id);
q.setInteger("_id",_id); client = (Customer) q.list().iterator().next();
session.delete((Customer)q.list().iterator().next()); } catch (Exception e) {
tx.commit();
}
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally {
if (session.isOpen()) session.close();
}
return client;
}
public void deleteCustomer(int _id) {
Transaction tx = null;
try {
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
session.flush();
tx = session.beginTransaction();
Query q = session.createQuery(" from Customer a where a.customerId =:_id");
q.setInteger("_id", _id);
session.delete(q.list().iterator().next());
tx.commit();
} catch (Exception e) {
e.printStackTrace();
assert tx != null;
tx.rollback(); tx.rollback();
throw e; throw e;
} finally {
if (session.isOpen()) session.close();
} }
finally{ }
if (session.isOpen())session.close();
}
}
public List<PurchaseOrder> getPurchase(){ public List<PurchaseOrder> getPurchase() {
List resultat=null; List<PurchaseOrder> resultat = null;
Transaction tx=null;
try{
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession();
session.flush();
tx=session.beginTransaction();
Query q=session.createQuery("select po.customerId, po.productId, po.quantity, po.shippingCost, po.salesDate, po.shippingDate, po.freightCompany from PurchaseOrder po");
resultat=(List<PurchaseOrder>)q.list();
}
catch (Exception e) {
e.printStackTrace();
}
finally{
if (session.isOpen())session.close();
}
return resultat;
}
public List<PurchaseOrder> getPurchase(int id){ try {
List resultat=null; if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
Transaction tx=null;
try{
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession();
session.flush(); session.flush();
tx=session.beginTransaction();
Query q=session.createQuery(" from PurchaseOrder a where a.customerId=:_id");
q.setInteger("_id", id);
resultat=(List<PurchaseOrder>)q.list();
}
catch (Exception e) {
e.printStackTrace();
}
finally{
if (session.isOpen())session.close();
}
return resultat;
}
public int getMaxId(){ session.beginTransaction();
Transaction tx=null; Query q = session.createQuery("select po.customerId, po.productId, po.quantity, po.shippingCost, po.salesDate, po.shippingDate, po.freightCompany from PurchaseOrder po");
int resultat=-1; resultat = q.list();
try{ } catch (Exception e) {
if(!session.isOpen())session=HibernateUtil.getSessionFactory().openSession(); e.printStackTrace();
} finally {
if (session.isOpen()) session.close();
}
return resultat;
}
public List<PurchaseOrder> getPurchase(int id) {
List<PurchaseOrder> resultat = null;
try {
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
session.flush(); session.flush();
tx=session.beginTransaction(); session.beginTransaction();
Query q=session.createQuery("select MAX(a.customerId) from Customer a"); Query q = session.createQuery(" from PurchaseOrder a where a.customerId=:_id");
q.setInteger("_id", id);
resultat=(int)q.list().iterator().next(); resultat = q.list();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (session.isOpen()) session.close();
} }
catch (Exception e) {
e.printStackTrace(); return resultat;
}
public int getMaxId() {
int resultat = -1;
try {
if (!session.isOpen()) session = HibernateUtil.getSessionFactory().openSession();
session.flush();
session.beginTransaction();
Query q = session.createQuery("select MAX(a.customerId) from Customer a");
resultat = (int) q.list().iterator().next();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (session.isOpen()) session.close();
} }
finally{
if (session.isOpen())session.close(); return resultat;
}
}
return resultat;
}
} }

View file

@ -1,42 +1,42 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.Manufacturer" table="MANUFACTURER" schema="APP"> <class name="DAO.Manufacturer" table="MANUFACTURER" schema="APP">
<id name="manufacturerId" type="int"> <id name="manufacturerId" type="int">
<column name="MANUFACTURER_ID" /> <column name="MANUFACTURER_ID"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="name" type="string"> <property name="name" type="string">
<column name="NAME" length="30" /> <column name="NAME" length="30"/>
</property> </property>
<property name="addressline1" type="string"> <property name="addressline1" type="string">
<column name="ADDRESSLINE1" length="30" /> <column name="ADDRESSLINE1" length="30"/>
</property> </property>
<property name="addressline2" type="string"> <property name="addressline2" type="string">
<column name="ADDRESSLINE2" length="30" /> <column name="ADDRESSLINE2" length="30"/>
</property> </property>
<property name="city" type="string"> <property name="city" type="string">
<column name="CITY" length="25" /> <column name="CITY" length="25"/>
</property> </property>
<property name="state" type="string"> <property name="state" type="string">
<column name="STATE" length="2" /> <column name="STATE" length="2"/>
</property> </property>
<property name="zip" type="string"> <property name="zip" type="string">
<column name="ZIP" length="10" /> <column name="ZIP" length="10"/>
</property> </property>
<property name="phone" type="string"> <property name="phone" type="string">
<column name="PHONE" length="12" /> <column name="PHONE" length="12"/>
</property> </property>
<property name="fax" type="string"> <property name="fax" type="string">
<column name="FAX" length="12" /> <column name="FAX" length="12"/>
</property> </property>
<property name="email" type="string"> <property name="email" type="string">
<column name="EMAIL" length="40" /> <column name="EMAIL" length="40"/>
</property> </property>
<property name="rep" type="string"> <property name="rep" type="string">
<column name="REP" length="30" /> <column name="REP" length="30"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -2,127 +2,135 @@ package DAO;
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1 // Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
/** /**
* Manufacturer generated by hbm2java * Manufacturer generated by hbm2java
*/ */
public class Manufacturer implements java.io.Serializable { public class Manufacturer implements java.io.Serializable {
private int manufacturerId; private int manufacturerId;
private String name; private String name;
private String addressline1; private String addressline1;
private String addressline2; private String addressline2;
private String city; private String city;
private String state; private String state;
private String zip; private String zip;
private String phone; private String phone;
private String fax; private String fax;
private String email; private String email;
private String rep; private String rep;
public Manufacturer() { public Manufacturer() {
} }
public Manufacturer(int manufacturerId) { public Manufacturer(int manufacturerId) {
this.manufacturerId = manufacturerId; this.manufacturerId = manufacturerId;
} }
public Manufacturer(int manufacturerId, String name, String addressline1, String addressline2, String city, String state, String zip, String phone, String fax, String email, String rep) { public Manufacturer(int manufacturerId, String name, String addressline1, String addressline2, String city, String state, String zip, String phone, String fax, String email, String rep) {
this.manufacturerId = manufacturerId; this.manufacturerId = manufacturerId;
this.name = name; this.name = name;
this.addressline1 = addressline1; this.addressline1 = addressline1;
this.addressline2 = addressline2; this.addressline2 = addressline2;
this.city = city; this.city = city;
this.state = state; this.state = state;
this.zip = zip; this.zip = zip;
this.phone = phone; this.phone = phone;
this.fax = fax; this.fax = fax;
this.email = email; this.email = email;
this.rep = rep; this.rep = rep;
} }
public int getManufacturerId() { public int getManufacturerId() {
return this.manufacturerId; return this.manufacturerId;
} }
public void setManufacturerId(int manufacturerId) { public void setManufacturerId(int manufacturerId) {
this.manufacturerId = manufacturerId; this.manufacturerId = manufacturerId;
} }
public String getName() { public String getName() {
return this.name; return this.name;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String getAddressline1() { public String getAddressline1() {
return this.addressline1; return this.addressline1;
} }
public void setAddressline1(String addressline1) { public void setAddressline1(String addressline1) {
this.addressline1 = addressline1; this.addressline1 = addressline1;
} }
public String getAddressline2() { public String getAddressline2() {
return this.addressline2; return this.addressline2;
} }
public void setAddressline2(String addressline2) { public void setAddressline2(String addressline2) {
this.addressline2 = addressline2; this.addressline2 = addressline2;
} }
public String getCity() { public String getCity() {
return this.city; return this.city;
} }
public void setCity(String city) { public void setCity(String city) {
this.city = city; this.city = city;
} }
public String getState() { public String getState() {
return this.state; return this.state;
} }
public void setState(String state) { public void setState(String state) {
this.state = state; this.state = state;
} }
public String getZip() { public String getZip() {
return this.zip; return this.zip;
} }
public void setZip(String zip) { public void setZip(String zip) {
this.zip = zip; this.zip = zip;
} }
public String getPhone() { public String getPhone() {
return this.phone; return this.phone;
} }
public void setPhone(String phone) { public void setPhone(String phone) {
this.phone = phone; this.phone = phone;
} }
public String getFax() { public String getFax() {
return this.fax; return this.fax;
} }
public void setFax(String fax) { public void setFax(String fax) {
this.fax = fax; this.fax = fax;
} }
public String getEmail() { public String getEmail() {
return this.email; return this.email;
} }
public void setEmail(String email) { public void setEmail(String email) {
this.email = email; this.email = email;
} }
public String getRep() { public String getRep() {
return this.rep; return this.rep;
} }
public void setRep(String rep) { public void setRep(String rep) {
this.rep = rep; this.rep = rep;
} }
} }

View file

@ -1,21 +1,21 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.MicroMarket" table="MICRO_MARKET" schema="APP"> <class name="DAO.MicroMarket" table="MICRO_MARKET" schema="APP">
<id name="zipCode" type="string"> <id name="zipCode" type="string">
<column name="ZIP_CODE" length="10" /> <column name="ZIP_CODE" length="10"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="radius" type="java.lang.Double"> <property name="radius" type="java.lang.Double">
<column name="RADIUS" precision="52" scale="0" /> <column name="RADIUS" precision="52" scale="0"/>
</property> </property>
<property name="areaLength" type="java.lang.Double"> <property name="areaLength" type="java.lang.Double">
<column name="AREA_LENGTH" precision="52" scale="0" /> <column name="AREA_LENGTH" precision="52" scale="0"/>
</property> </property>
<property name="areaWidth" type="java.lang.Double"> <property name="areaWidth" type="java.lang.Double">
<column name="AREA_WIDTH" precision="52" scale="0" /> <column name="AREA_WIDTH" precision="52" scale="0"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -2,64 +2,65 @@ package DAO;
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1 // Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
/** /**
* MicroMarket generated by hbm2java * MicroMarket generated by hbm2java
*/ */
public class MicroMarket implements java.io.Serializable { public class MicroMarket implements java.io.Serializable {
private String zipCode; private String zipCode;
private Double radius; private Double radius;
private Double areaLength; private Double areaLength;
private Double areaWidth; private Double areaWidth;
public MicroMarket() { public MicroMarket() {
} }
public MicroMarket(String zipCode) { public MicroMarket(String zipCode) {
this.zipCode = zipCode; this.zipCode = zipCode;
} }
public MicroMarket(String zipCode, Double radius, Double areaLength, Double areaWidth) { public MicroMarket(String zipCode, Double radius, Double areaLength, Double areaWidth) {
this.zipCode = zipCode; this.zipCode = zipCode;
this.radius = radius; this.radius = radius;
this.areaLength = areaLength; this.areaLength = areaLength;
this.areaWidth = areaWidth; this.areaWidth = areaWidth;
} }
public String getZipCode() { public String getZipCode() {
return this.zipCode; return this.zipCode;
} }
public void setZipCode(String zipCode) { public void setZipCode(String zipCode) {
this.zipCode = zipCode; this.zipCode = zipCode;
} }
public Double getRadius() { public Double getRadius() {
return this.radius; return this.radius;
} }
public void setRadius(Double radius) { public void setRadius(Double radius) {
this.radius = radius; this.radius = radius;
} }
public Double getAreaLength() { public Double getAreaLength() {
return this.areaLength; return this.areaLength;
} }
public void setAreaLength(Double areaLength) { public void setAreaLength(Double areaLength) {
this.areaLength = areaLength; this.areaLength = areaLength;
} }
public Double getAreaWidth() { public Double getAreaWidth() {
return this.areaWidth; return this.areaWidth;
} }
public void setAreaWidth(Double areaWidth) { public void setAreaWidth(Double areaWidth) {
this.areaWidth = areaWidth; this.areaWidth = areaWidth;
} }
} }

View file

@ -1,33 +1,33 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.Product" table="PRODUCT" schema="APP"> <class name="DAO.Product" table="PRODUCT" schema="APP">
<id name="productId" type="int"> <id name="productId" type="int">
<column name="PRODUCT_ID" /> <column name="PRODUCT_ID"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="manufacturerId" type="int"> <property name="manufacturerId" type="int">
<column name="MANUFACTURER_ID" not-null="true" /> <column name="MANUFACTURER_ID" not-null="true"/>
</property> </property>
<property name="productCode" type="string"> <property name="productCode" type="string">
<column name="PRODUCT_CODE" length="2" not-null="true" /> <column name="PRODUCT_CODE" length="2" not-null="true"/>
</property> </property>
<property name="purchaseCost" type="big_decimal"> <property name="purchaseCost" type="big_decimal">
<column name="PURCHASE_COST" precision="12" /> <column name="PURCHASE_COST" precision="12"/>
</property> </property>
<property name="quantityOnHand" type="java.lang.Integer"> <property name="quantityOnHand" type="java.lang.Integer">
<column name="QUANTITY_ON_HAND" /> <column name="QUANTITY_ON_HAND"/>
</property> </property>
<property name="markup" type="big_decimal"> <property name="markup" type="big_decimal">
<column name="MARKUP" precision="4" /> <column name="MARKUP" precision="4"/>
</property> </property>
<property name="available" type="string"> <property name="available" type="string">
<column name="AVAILABLE" length="5" /> <column name="AVAILABLE" length="5"/>
</property> </property>
<property name="description" type="string"> <property name="description" type="string">
<column name="DESCRIPTION" length="50" /> <column name="DESCRIPTION" length="50"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -7,98 +7,104 @@ import java.math.BigDecimal;
/** /**
* Product generated by hbm2java * Product generated by hbm2java
*/ */
public class Product implements java.io.Serializable { public class Product implements java.io.Serializable {
private int productId; private int productId;
private int manufacturerId; private int manufacturerId;
private String productCode; private String productCode;
private BigDecimal purchaseCost; private BigDecimal purchaseCost;
private Integer quantityOnHand; private Integer quantityOnHand;
private BigDecimal markup; private BigDecimal markup;
private String available; private String available;
private String description; private String description;
public Product() { public Product() {
} }
public Product(int productId, int manufacturerId, String productCode) { public Product(int productId, int manufacturerId, String productCode) {
this.productId = productId; this.productId = productId;
this.manufacturerId = manufacturerId; this.manufacturerId = manufacturerId;
this.productCode = productCode; this.productCode = productCode;
} }
public Product(int productId, int manufacturerId, String productCode, BigDecimal purchaseCost, Integer quantityOnHand, BigDecimal markup, String available, String description) { public Product(int productId, int manufacturerId, String productCode, BigDecimal purchaseCost, Integer quantityOnHand, BigDecimal markup, String available, String description) {
this.productId = productId; this.productId = productId;
this.manufacturerId = manufacturerId; this.manufacturerId = manufacturerId;
this.productCode = productCode; this.productCode = productCode;
this.purchaseCost = purchaseCost; this.purchaseCost = purchaseCost;
this.quantityOnHand = quantityOnHand; this.quantityOnHand = quantityOnHand;
this.markup = markup; this.markup = markup;
this.available = available; this.available = available;
this.description = description; this.description = description;
} }
public int getProductId() { public int getProductId() {
return this.productId; return this.productId;
} }
public void setProductId(int productId) { public void setProductId(int productId) {
this.productId = productId; this.productId = productId;
} }
public int getManufacturerId() { public int getManufacturerId() {
return this.manufacturerId; return this.manufacturerId;
} }
public void setManufacturerId(int manufacturerId) { public void setManufacturerId(int manufacturerId) {
this.manufacturerId = manufacturerId; this.manufacturerId = manufacturerId;
} }
public String getProductCode() { public String getProductCode() {
return this.productCode; return this.productCode;
} }
public void setProductCode(String productCode) { public void setProductCode(String productCode) {
this.productCode = productCode; this.productCode = productCode;
} }
public BigDecimal getPurchaseCost() { public BigDecimal getPurchaseCost() {
return this.purchaseCost; return this.purchaseCost;
} }
public void setPurchaseCost(BigDecimal purchaseCost) { public void setPurchaseCost(BigDecimal purchaseCost) {
this.purchaseCost = purchaseCost; this.purchaseCost = purchaseCost;
} }
public Integer getQuantityOnHand() { public Integer getQuantityOnHand() {
return this.quantityOnHand; return this.quantityOnHand;
} }
public void setQuantityOnHand(Integer quantityOnHand) { public void setQuantityOnHand(Integer quantityOnHand) {
this.quantityOnHand = quantityOnHand; this.quantityOnHand = quantityOnHand;
} }
public BigDecimal getMarkup() { public BigDecimal getMarkup() {
return this.markup; return this.markup;
} }
public void setMarkup(BigDecimal markup) { public void setMarkup(BigDecimal markup) {
this.markup = markup; this.markup = markup;
} }
public String getAvailable() { public String getAvailable() {
return this.available; return this.available;
} }
public void setAvailable(String available) { public void setAvailable(String available) {
this.available = available; this.available = available;
} }
public String getDescription() { public String getDescription() {
return this.description; return this.description;
} }
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
} }

View file

@ -1,18 +1,18 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.ProductCode" table="PRODUCT_CODE" schema="APP"> <class name="DAO.ProductCode" table="PRODUCT_CODE" schema="APP">
<id name="prodCode" type="string"> <id name="prodCode" type="string">
<column name="PROD_CODE" length="2" /> <column name="PROD_CODE" length="2"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="discountCode" type="char"> <property name="discountCode" type="char">
<column name="DISCOUNT_CODE" length="1" not-null="true" /> <column name="DISCOUNT_CODE" length="1" not-null="true"/>
</property> </property>
<property name="description" type="string"> <property name="description" type="string">
<column name="DESCRIPTION" length="10" /> <column name="DESCRIPTION" length="10"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -2,56 +2,56 @@ package DAO;
// Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1 // Generated 8 avr. 2022 15:30:27 by Hibernate Tools 4.3.1
/** /**
* ProductCode generated by hbm2java * ProductCode generated by hbm2java
*/ */
public class ProductCode implements java.io.Serializable { public class ProductCode implements java.io.Serializable {
private String prodCode; private String prodCode;
private char discountCode; private char discountCode;
private String description; private String description;
public ProductCode() { public ProductCode() {
} }
public ProductCode(String prodCode, char discountCode) { public ProductCode(String prodCode, char discountCode) {
this.prodCode = prodCode; this.prodCode = prodCode;
this.discountCode = discountCode; this.discountCode = discountCode;
} }
public ProductCode(String prodCode, char discountCode, String description) { public ProductCode(String prodCode, char discountCode, String description) {
this.prodCode = prodCode; this.prodCode = prodCode;
this.discountCode = discountCode; this.discountCode = discountCode;
this.description = description; this.description = description;
} }
public String getProdCode() { public String getProdCode() {
return this.prodCode; return this.prodCode;
} }
public void setProdCode(String prodCode) { public void setProdCode(String prodCode) {
this.prodCode = prodCode; this.prodCode = prodCode;
} }
public char getDiscountCode() { public char getDiscountCode() {
return this.discountCode; return this.discountCode;
} }
public void setDiscountCode(char discountCode) { public void setDiscountCode(char discountCode) {
this.discountCode = discountCode; this.discountCode = discountCode;
} }
public String getDescription() { public String getDescription() {
return this.description; return this.description;
} }
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
} }

View file

@ -1,33 +1,33 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 --> <!-- Generated 8 avr. 2022 15:30:29 by Hibernate Tools 4.3.1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="DAO.PurchaseOrder" table="PURCHASE_ORDER" schema="APP"> <class name="DAO.PurchaseOrder" table="PURCHASE_ORDER" schema="APP">
<id name="orderNum" type="int"> <id name="orderNum" type="int">
<column name="ORDER_NUM" /> <column name="ORDER_NUM"/>
<generator class="assigned"></generator> <generator class="assigned"></generator>
</id> </id>
<property name="customerId" type="int"> <property name="customerId" type="int">
<column name="CUSTOMER_ID" not-null="true" /> <column name="CUSTOMER_ID" not-null="true"/>
</property> </property>
<property name="productId" type="int"> <property name="productId" type="int">
<column name="PRODUCT_ID" not-null="true" /> <column name="PRODUCT_ID" not-null="true"/>
</property> </property>
<property name="quantity" type="java.lang.Short"> <property name="quantity" type="java.lang.Short">
<column name="QUANTITY" /> <column name="QUANTITY"/>
</property> </property>
<property name="shippingCost" type="big_decimal"> <property name="shippingCost" type="big_decimal">
<column name="SHIPPING_COST" precision="12" /> <column name="SHIPPING_COST" precision="12"/>
</property> </property>
<property name="salesDate" type="date"> <property name="salesDate" type="date">
<column name="SALES_DATE" length="10" /> <column name="SALES_DATE" length="10"/>
</property> </property>
<property name="shippingDate" type="date"> <property name="shippingDate" type="date">
<column name="SHIPPING_DATE" length="10" /> <column name="SHIPPING_DATE" length="10"/>
</property> </property>
<property name="freightCompany" type="string"> <property name="freightCompany" type="string">
<column name="FREIGHT_COMPANY" length="30" /> <column name="FREIGHT_COMPANY" length="30"/>
</property> </property>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View file

@ -8,98 +8,104 @@ import java.util.Date;
/** /**
* PurchaseOrder generated by hbm2java * PurchaseOrder generated by hbm2java
*/ */
public class PurchaseOrder implements java.io.Serializable { public class PurchaseOrder implements java.io.Serializable {
private int orderNum; private int orderNum;
private int customerId; private int customerId;
private int productId; private int productId;
private Short quantity; private Short quantity;
private BigDecimal shippingCost; private BigDecimal shippingCost;
private Date salesDate; private Date salesDate;
private Date shippingDate; private Date shippingDate;
private String freightCompany; private String freightCompany;
public PurchaseOrder() { public PurchaseOrder() {
} }
public PurchaseOrder(int orderNum, int customerId, int productId) { public PurchaseOrder(int orderNum, int customerId, int productId) {
this.orderNum = orderNum; this.orderNum = orderNum;
this.customerId = customerId; this.customerId = customerId;
this.productId = productId; this.productId = productId;
} }
public PurchaseOrder(int orderNum, int customerId, int productId, Short quantity, BigDecimal shippingCost, Date salesDate, Date shippingDate, String freightCompany) { public PurchaseOrder(int orderNum, int customerId, int productId, Short quantity, BigDecimal shippingCost, Date salesDate, Date shippingDate, String freightCompany) {
this.orderNum = orderNum; this.orderNum = orderNum;
this.customerId = customerId; this.customerId = customerId;
this.productId = productId; this.productId = productId;
this.quantity = quantity; this.quantity = quantity;
this.shippingCost = shippingCost; this.shippingCost = shippingCost;
this.salesDate = salesDate; this.salesDate = salesDate;
this.shippingDate = shippingDate; this.shippingDate = shippingDate;
this.freightCompany = freightCompany; this.freightCompany = freightCompany;
} }
public int getOrderNum() { public int getOrderNum() {
return this.orderNum; return this.orderNum;
} }
public void setOrderNum(int orderNum) { public void setOrderNum(int orderNum) {
this.orderNum = orderNum; this.orderNum = orderNum;
} }
public int getCustomerId() { public int getCustomerId() {
return this.customerId; return this.customerId;
} }
public void setCustomerId(int customerId) { public void setCustomerId(int customerId) {
this.customerId = customerId; this.customerId = customerId;
} }
public int getProductId() { public int getProductId() {
return this.productId; return this.productId;
} }
public void setProductId(int productId) { public void setProductId(int productId) {
this.productId = productId; this.productId = productId;
} }
public Short getQuantity() { public Short getQuantity() {
return this.quantity; return this.quantity;
} }
public void setQuantity(Short quantity) { public void setQuantity(Short quantity) {
this.quantity = quantity; this.quantity = quantity;
} }
public BigDecimal getShippingCost() { public BigDecimal getShippingCost() {
return this.shippingCost; return this.shippingCost;
} }
public void setShippingCost(BigDecimal shippingCost) { public void setShippingCost(BigDecimal shippingCost) {
this.shippingCost = shippingCost; this.shippingCost = shippingCost;
} }
public Date getSalesDate() { public Date getSalesDate() {
return this.salesDate; return this.salesDate;
} }
public void setSalesDate(Date salesDate) { public void setSalesDate(Date salesDate) {
this.salesDate = salesDate; this.salesDate = salesDate;
} }
public Date getShippingDate() { public Date getShippingDate() {
return this.shippingDate; return this.shippingDate;
} }
public void setShippingDate(Date shippingDate) { public void setShippingDate(Date shippingDate) {
this.shippingDate = shippingDate; this.shippingDate = shippingDate;
} }
public String getFreightCompany() { public String getFreightCompany() {
return this.freightCompany; return this.freightCompany;
} }
public void setFreightCompany(String freightCompany) { public void setFreightCompany(String freightCompany) {
this.freightCompany = freightCompany; this.freightCompany = freightCompany;
} }
} }

View file

@ -4,79 +4,70 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
package controller; package controller;
import DAO.*;
import DAO.MagasinHelper;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
import service.User; import service.User;
import java.util.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpSession;
import org.springframework.context.ApplicationContext; import java.util.Arrays;
import org.springframework.context.support.ClassPathXmlApplicationContext; import java.util.HashMap;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
import javax.servlet.http.*;
import javax.servlet.*;
/** /**
*
* @author faycal * @author faycal
*/ */
public class BddController extends MultiActionController { public class BddController extends MultiActionController {
private String login; private String login;
private String pwd;
private User utilisateur; private User utilisateur;
private HttpSession session; private HttpSession session;
public BddController() {}
private void sessionInit(HttpServletRequest request) { private void sessionInit(HttpServletRequest request) {
if (login == null) if (login == null)
login=request.getUserPrincipal().getName(); login = request.getUserPrincipal().getName();
if (utilisateur == null) if (utilisateur == null)
utilisateur =new User(login); utilisateur = new User(login);
if (session == null) { if (session == null) {
session=request.getSession(); session = request.getSession();
session.setAttribute("user", utilisateur); session.setAttribute("user", utilisateur);
} }
} }
public ModelAndView menu(HttpServletRequest request, public ModelAndView menu(HttpServletRequest request, HttpServletResponse response) {
HttpServletResponse response){
sessionInit(request); sessionInit(request);
System.out.println ("nbuser="+User.getCompteur()); System.out.println("nbuser=" + User.getCompteur());
return new ModelAndView("menu").addObject("user",utilisateur); return new ModelAndView("menu").addObject("user", utilisateur);
} }
public ModelAndView logout(HttpServletRequest request,
HttpServletResponse response){ public ModelAndView logout(HttpServletRequest request, HttpServletResponse response) {
sessionInit(request); sessionInit(request);
request.getSession().invalidate(); request.getSession().invalidate();
return new ModelAndView("deconnexion");
return new ModelAndView("deconnexion");
} }
public ModelAndView list(HttpServletRequest request, public ModelAndView list(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpServletResponse response) throws Exception { sessionInit(request);
sessionInit(request); String type = request.getAttribute("type").toString();
String type = request.getAttribute("type").toString(); ModelAndView mv = new ModelAndView("resultat");
ModelAndView mv = new ModelAndView("resultat"); mv.addObject("user", session.getAttribute("user"));
mv.addObject("user",session.getAttribute("user")); mv.addObject("type", type);
mv.addObject("type", type);
switch (type) {
switch (type) { case "customer":
case "customer":
mv.addObject("results", new MagasinHelper().getClients()); mv.addObject("results", new MagasinHelper().getClients());
mv.addObject("colonnes", Arrays.asList("customerId", "name", "addressline1", "addressline2", "zip", "rate")); mv.addObject("colonnes", Arrays.asList("customerId", "name", "addressline1", "addressline2", "zip", "rate"));
break; break;
case "product": case "product":
mv.addObject("results", new MagasinHelper().getProducts()); mv.addObject("results", new MagasinHelper().getProducts());
mv.addObject("colonnes", Arrays.asList("productId", "manufacturerId", "productCode", "purchaseCost", "quantityOnHand", "markup", "available", "description")); mv.addObject("colonnes", Arrays.asList("productId", "manufacturerId", "productCode", "purchaseCost", "quantityOnHand", "markup", "available", "description"));
break; break;
case "purchase": case "purchase":
mv.addObject("results", new MagasinHelper().getPurchase()); mv.addObject("results", new MagasinHelper().getPurchase());
mv.addObject("colonnes", Arrays.asList("customerId", "productId", "quantity", "shippingCost", "salesDate", "shippingDate", "freightCompany")); mv.addObject("colonnes", Arrays.asList("customerId", "productId", "quantity", "shippingCost", "salesDate", "shippingDate", "freightCompany"));
mv.addObject("relation", new HashMap<String, String>() {{ mv.addObject("relation", new HashMap<String, String>() {{
@ -84,130 +75,117 @@ public class BddController extends MultiActionController {
put("productId", "product"); put("productId", "product");
}}); }});
break; break;
default: default:
mv.addObject("error", "Type not found"); mv.addObject("error", "Type not found");
} }
return mv; return mv;
} }
public ModelAndView purchase(HttpServletRequest request, HttpServletResponse response) throws Exception { public ModelAndView purchase(HttpServletRequest request, HttpServletResponse response) throws Exception {
request.setAttribute("type", "purchase"); request.setAttribute("type", "purchase");
return list(request, response); return list(request, response);
} }
public ModelAndView product(HttpServletRequest request, HttpServletResponse response) throws Exception { public ModelAndView product(HttpServletRequest request, HttpServletResponse response) throws Exception {
request.setAttribute("type", "product"); request.setAttribute("type", "product");
return list(request, response); return list(request, response);
} }
public ModelAndView customer(HttpServletRequest request, HttpServletResponse response) throws Exception { public ModelAndView customer(HttpServletRequest request, HttpServletResponse response) throws Exception {
request.setAttribute("type", "customer"); request.setAttribute("type", "customer");
return list(request, response); return list(request, response);
} }
public ModelAndView add(HttpServletRequest request, public ModelAndView add(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpServletResponse response) throws Exception { sessionInit(request);
sessionInit(request); ModelAndView mv = new ModelAndView("form_inscription");
mv.addObject("user", session.getAttribute("user"));
ModelAndView mv = new ModelAndView("form_inscription"); mv.addObject("discount", new MagasinHelper().getDiscountCode());
mv.addObject("code", new MagasinHelper().getZipCode());
mv.addObject("user",session.getAttribute("user")); return mv;
mv.addObject("discount",new MagasinHelper().getDiscountCode()); }
mv.addObject("code",new MagasinHelper().getZipCode());
return mv; public ModelAndView detail(HttpServletRequest request, HttpServletResponse response) throws Exception {
} sessionInit(request);
public ModelAndView detail(HttpServletRequest request, String type = request.getParameter("type");
HttpServletResponse response) throws Exception { ModelAndView mv = new ModelAndView("detail");
sessionInit(request); mv.addObject("user", session.getAttribute("user"));
String type = request.getParameter("type"); mv.addObject("type", type);
ModelAndView mv = new ModelAndView("detail");
mv.addObject("user",session.getAttribute("user")); switch (type) {
mv.addObject("type", type); case "customer":
switch (type) {
case "customer":
mv.addObject("result", new MagasinHelper().getClient(Integer.parseInt(request.getParameter("num")))); mv.addObject("result", new MagasinHelper().getClient(Integer.parseInt(request.getParameter("num"))));
mv.addObject("colonnes", Arrays.asList("customerId", "name", "addressline1", "addressline2", "zip", "rate")); mv.addObject("colonnes", Arrays.asList("customerId", "name", "addressline1", "addressline2", "zip", "rate"));
mv.addObject("code",new MagasinHelper().getDiscountCode()); mv.addObject("code", new MagasinHelper().getDiscountCode());
mv.addObject("cpostaux",new MagasinHelper().getZipCode()); mv.addObject("cpostaux", new MagasinHelper().getZipCode());
break; break;
case "product": case "product":
mv.addObject("result", new MagasinHelper().getProduct(Integer.parseInt(request.getParameter("num")))); mv.addObject("result", new MagasinHelper().getProduct(Integer.parseInt(request.getParameter("num"))));
mv.addObject("colonnes", Arrays.asList("productId", "manufacturerId", "productCode", "purchaseCost", "quantityOnHand", "markup", "available", "description")); mv.addObject("colonnes", Arrays.asList("productId", "manufacturerId", "productCode", "purchaseCost", "quantityOnHand", "markup", "available", "description"));
break; break;
case "purchase": case "purchase":
mv.addObject("result", new MagasinHelper().getPurchase(Integer.parseInt(request.getParameter("num")))); mv.addObject("result", new MagasinHelper().getPurchase(Integer.parseInt(request.getParameter("num"))));
mv.addObject("colonnes", Arrays.asList("customerId", "productId", "quantity", "shippingCost", "salesDate", "shippingDate", "freightCompany")); mv.addObject("colonnes", Arrays.asList("customerId", "productId", "quantity", "shippingCost", "salesDate", "shippingDate", "freightCompany"));
break; break;
default: default:
mv.addObject("error", "Type not found"); mv.addObject("error", "Type not found");
} }
return mv; return mv;
} }
public ModelAndView find(HttpServletRequest request,
HttpServletResponse response) throws Exception { public ModelAndView find(HttpServletRequest request, HttpServletResponse response) throws Exception {
sessionInit(request);
ModelAndView mv ;
MagasinHelper requeteur = new MagasinHelper();
if (requeteur.getClients(request.getParameter("nom")).isEmpty() || request.getParameter("nom").equals("%") ){
mv= new ModelAndView("error");
mv.addObject("erreur", "0 enregistrement");
}
else{
mv= new ModelAndView("resultat");
mv.addObject("liste",requeteur.getClients(request.getParameter("nom")));
}
mv.addObject("user",session.getAttribute("user"));
return mv;
}
public ModelAndView formfind(HttpServletRequest request,
HttpServletResponse response) throws Exception {
sessionInit(request);
return new ModelAndView("recherche");
}
public ModelAndView achats(HttpServletRequest request,
HttpServletResponse response) throws Exception {
sessionInit(request);
ModelAndView mv = new ModelAndView("achats");
mv.addObject("user",session.getAttribute("user"));
System.out.println("num "+Integer.parseInt(request.getParameter("numero")));
mv.addObject("achats",new MagasinHelper().getPurchase(Integer.parseInt(request.getParameter("numero"))));
return mv;
}
public ModelAndView save(HttpServletRequest request,
HttpServletResponse response) throws Exception {
sessionInit(request); sessionInit(request);
String param1 = request.getParameter("nom");
ModelAndView mv;
MagasinHelper requeteur = new MagasinHelper();
if (requeteur.getClients(request.getParameter("nom")).isEmpty() || request.getParameter("nom").equals("%")) {
mv = new ModelAndView("error");
mv.addObject("erreur", "0 enregistrement");
} else {
mv = new ModelAndView("resultat");
mv.addObject("liste", requeteur.getClients(request.getParameter("nom")));
}
mv.addObject("user", session.getAttribute("user"));
return mv;
}
public ModelAndView formfind(HttpServletRequest request, HttpServletResponse response) throws Exception {
sessionInit(request);
return new ModelAndView("recherche");
}
public ModelAndView achats(HttpServletRequest request, HttpServletResponse response) throws Exception {
sessionInit(request);
ModelAndView mv = new ModelAndView("achats");
mv.addObject("user", session.getAttribute("user"));
System.out.println("num " + Integer.parseInt(request.getParameter("numero")));
mv.addObject("achats", new MagasinHelper().getPurchase(Integer.parseInt(request.getParameter("numero"))));
return mv;
}
public ModelAndView save(HttpServletRequest request, HttpServletResponse response) throws Exception {
sessionInit(request);
String param1 = request.getParameter("nom");
String param2 = request.getParameter("adresse"); String param2 = request.getParameter("adresse");
String param3 = request.getParameter("telephone"); String param3 = request.getParameter("telephone");
String param4 = request.getParameter("email"); String param4 = request.getParameter("email");
String param5 = request.getParameter("code_remise"); String param5 = request.getParameter("code_remise");
String param6 = request.getParameter("CP"); String param6 = request.getParameter("CP");
new MagasinHelper().insertCustomer(new MagasinHelper().getMaxId()+1, param5.charAt(0), param6); new MagasinHelper().insertCustomer(new MagasinHelper().getMaxId() + 1, param5.charAt(0), param6);
return new ModelAndView("confirm").addObject("confirm","enregistrement effectué"); return new ModelAndView("confirm").addObject("confirm", "enregistrement effectué");
}
}
public ModelAndView delete(HttpServletRequest request, public ModelAndView delete(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpServletResponse response) throws Exception { sessionInit(request);
sessionInit(request);
new MagasinHelper().deleteCustomer(Integer.parseInt(request.getParameter("numero"))); new MagasinHelper().deleteCustomer(Integer.parseInt(request.getParameter("numero")));
return new ModelAndView("confirm").addObject("confirm","suppression effectuée"); return new ModelAndView("confirm").addObject("confirm", "suppression effectuée");
}
}
public ModelAndView update(HttpServletRequest request, public ModelAndView update(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpServletResponse response) throws Exception {
sessionInit(request); sessionInit(request);
String param1 = request.getParameter("numero"); String param1 = request.getParameter("numero");
String param2 = request.getParameter("code_remise"); String param2 = request.getParameter("code_remise");
@ -217,11 +195,9 @@ public class BddController extends MultiActionController {
String param6 = request.getParameter("email"); String param6 = request.getParameter("email");
String param7 = request.getParameter("CP"); String param7 = request.getParameter("CP");
System.out.println(request.getParameter("CP")); System.out.println(request.getParameter("CP"));
new MagasinHelper().updateCustomer(Integer.parseInt(param1), param2.charAt(0), param3, param4, param5, param6, param7);
new MagasinHelper().updateCustomer(Integer.valueOf(param1),param2.charAt(0),param3,param4,param5,param6,param7); return new ModelAndView("confirm").addObject("confirm", "mise à jour effectuée");
return new ModelAndView("confirm").addObject("confirm","mise à jour effectuée"); }
}
} }

View file

@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration> <hibernate-configuration>
<session-factory> <session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property> <property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="hibernate.connection.driver_class">org.apache.derby.jdbc.ClientDriver</property> <property name="hibernate.connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
<property name="hibernate.connection.url">jdbc:derby://localhost:1527/sample</property> <property name="hibernate.connection.url">jdbc:derby://localhost:1527/sample</property>
<property name="hibernate.connection.username">app</property> <property name="hibernate.connection.username">app</property>
<property name="hibernate.connection.password">app</property> <property name="hibernate.connection.password">app</property>
<mapping resource="DAO/DiscountCode.hbm.xml"/> <mapping resource="DAO/DiscountCode.hbm.xml"/>
<mapping resource="DAO/Product.hbm.xml"/> <mapping resource="DAO/Product.hbm.xml"/>
<mapping resource="DAO/PurchaseOrder.hbm.xml"/> <mapping resource="DAO/PurchaseOrder.hbm.xml"/>
<mapping resource="DAO/Manufacturer.hbm.xml"/> <mapping resource="DAO/Manufacturer.hbm.xml"/>
<mapping resource="DAO/MicroMarket.hbm.xml"/> <mapping resource="DAO/MicroMarket.hbm.xml"/>
<mapping resource="DAO/Customer.hbm.xml"/> <mapping resource="DAO/Customer.hbm.xml"/>
<mapping resource="DAO/ProductCode.hbm.xml"/> <mapping resource="DAO/ProductCode.hbm.xml"/>
</session-factory> </session-factory>
</hibernate-configuration> </hibernate-configuration>

View file

@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"> <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
<hibernate-reverse-engineering> <hibernate-reverse-engineering>
<schema-selection match-schema="APP"/> <schema-selection match-schema="APP"/>
<table-filter match-name="MANUFACTURER"/> <table-filter match-name="MANUFACTURER"/>
<table-filter match-name="PRODUCT"/> <table-filter match-name="PRODUCT"/>
<table-filter match-name="DISCOUNT_CODE"/> <table-filter match-name="DISCOUNT_CODE"/>
<table-filter match-name="PRODUCT_CODE"/> <table-filter match-name="PRODUCT_CODE"/>
<table-filter match-name="MICRO_MARKET"/> <table-filter match-name="MICRO_MARKET"/>
<table-filter match-name="PURCHASE_ORDER"/> <table-filter match-name="PURCHASE_ORDER"/>
<table-filter match-name="CUSTOMER"/> <table-filter match-name="CUSTOMER"/>
</hibernate-reverse-engineering> </hibernate-reverse-engineering>

View file

@ -4,39 +4,42 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
package service; package service;
import java.io.Serializable; import java.io.Serializable;
/** /**
*
* @author faycal * @author faycal
*/ */
public class User implements Serializable { public class User implements Serializable {
static private int compteur = 0;
private final int userId;
private String login; private String login;
private String pwd; private String pwd;
private int userId;
static private int compteur=0;
public static int getCompteur() {
return compteur;
}
public User() { public User() {
super(); super();
userId=compteur++; userId = compteur++;
} }
public void finalize(){
public User(String login) {
compteur--;
}
public User(String login) {
this.login = login; this.login = login;
userId=compteur++; userId = compteur++;
} }
public User(String login, String pwd) { public User(String login, String pwd) {
this.login = login; this.login = login;
this.pwd = pwd; this.pwd = pwd;
userId=compteur++; userId = compteur++;
}
public static int getCompteur() {
return compteur;
}
protected void finalize() {
compteur--;
} }
public String getLogin() { public String getLogin() {
@ -54,5 +57,4 @@ public class User implements Serializable {
public void setPwd(String pwd) { public void setPwd(String pwd) {
this.pwd = pwd; this.pwd = pwd;
} }
} }