Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

avinash sudh

Greenhorn
+ Follow
since Apr 22, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by avinash sudh

Hi ... Will HibernateTransactionManager rollback hibernate operations only or will it rollback any operation(like a jdbc insert) on the db.

If it does not rollback jdbc transactions then please let me know as to what could be done to rollback a combination(hibernate/jdbc) of db transactions.

Below is the code that i am using.
----------------------------------------------------------------------------------------------------------------------------------
Transaction.xml

<beans xmlns="http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">;

<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="save">PROPAGATION_REQUIRED</prop> ------- adding transaction interceptor on all the save methods.
</props>
</property>
</bean>

<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="dataSource" ref="dataSource" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>

</beans>
----------------------------------------------------------------------------------------------------------------------------------
public void save(Product product){
getHibernateTemplate().save(product);
jdbc call to insert into a table; }
---------------------------------------------------------------------------------------------------------------------------------
public class ProductQohDaoImpl extends HibernateDaoSupport implements ProductQohDao{

public void save(ProductQoh productQoh){
int x = 1/0; ---deliberately throwing an exception to rollback the transactions
getHibernateTemplate().save(productQoh);
}
}
----------------------------------------------------------------------------------------------------------------------------------

Thank you for your help.
Hi all,

I am new to hibernate and as I am learning Hibernate I get a feeling that i am missing out on the basics. Could you please let me know the prerequisites that I need to know before starting with Hibernate? Is it JPA and EJB?

Thanks.
tsuji

Thank you so much for the explanation given about the issue. It resolved my issue.
Peter ... thank you for giving me the link to the Maven central
7 years ago
Hi Carles,

I think I can ... I would like to change it to overcome this error.
Hi all,

I am trying to generate java classes out of ApiExceptionExtended.xsd. ApiExceptionExtended.xsd is an extension of ApiException.xsd.
However I am running into this error.

C:\Users\avinashms\POC\xero_POC\XSD_Download\XeroAPI-Schemas-master\v2.00\xsd_experiment>xjc -d src -p org.xero.poc.apiextended ApiExceptionExtended.xsd

parsing a schema...
[ERROR] cos-all-limited.1.2: An all model group must appear in a particle with {min occurs} = {max occurs} = 1, and that particle must be part of a pair which constitutes the {content type} of a complex ty
pe definition.
line 35 of file:/C:/Users/avinashms/POC/xero_POC/XSD_Download/XeroAPI-Schemas-master/v2.00/xsd_experiment/ApiExceptionExtended.xsd

[ERROR] s4s-elt-invalid-content.1: The content of '#AnonType_ElementsApiExceptionExtended' is invalid. Element 'element' is invalid, misplaced, or occurs too often.
line 38 of file:/C:/Users/avinashms/POC/xero_POC/XSD_Download/XeroAPI-Schemas-master/v2.00/xsd_experiment/ApiExceptionExtended.xsd
Below are the ApiException.xsd and ApiExceptionExtended.xsd files :

ApiException.xsd file :

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="ApiException" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">;

<!-- API Exception -->
<xs:complexType name="ApiException">
<xs:all>
<xs:element name="ErrorNumber" type="xs:integer" minOccurs="1" maxOccurs="1" />
<xs:element name="Type" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="Message" type="xs:string" minOccurs="1" maxOccurs="1" />
</xs:all>
</xs:complexType>

</xs:schema>

-----------------------------------------------------------------------------------------------------------------------------------

ApiExceptionExtended.xsd file :

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="ApiException"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema";
>

<xs:include schemaLocation="ApiException.xsd" />

<!--
<xs:include schemaLocation="Account.xsd" />
<xs:include schemaLocation="BankTransaction.xsd" />
<xs:include schemaLocation="BrandingTheme.xsd" />
<xs:include schemaLocation="Contact.xsd" />
<xs:include schemaLocation="CreditNote.xsd" />
<xs:include schemaLocation="Currency.xsd" />
<xs:include schemaLocation="Employee.xsd" />
<xs:include schemaLocation="ExpenseClaim.xsd" />
<xs:include schemaLocation="Invoice.xsd" />
<xs:include schemaLocation="Items.xsd" />
<xs:include schemaLocation="Journal.xsd" />
<xs:include schemaLocation="ManualJournal.xsd" />
<xs:include schemaLocation="Organisation.xsd" />
<xs:include schemaLocation="Payment.xsd" />
<xs:include schemaLocation="Receipt.xsd" />
<xs:include schemaLocation="Report.xsd" />
<xs:include schemaLocation="TaxRate.xsd" />
<xs:include schemaLocation="Tracking.xsd" />
<xs:include schemaLocation="User.xsd" />
-->

<!-- API Exception -->
<xs:complexType name="ApiExceptionExtended">
<xs:complexContent>
<xs:extension base="ApiException">
<xs:sequence>
<xs:element name="Elements" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:element name="DataContractBase" type="xs:anyType" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

</xs:schema>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Please let me know what I could do to fix it.
Thanks a lot Peter. Could you please tell me the location of Maven central and how you figured out the version of parent pom?
7 years ago
Hi i am getting the following error when i try to install the "Apache camel oauth tutorial" project(which is at http://camel.apache.org/tutorial-oauth.html). I have attached the pom.xml file. Please let me know what the issue is.

Scanning for projects...
The build could not read 1 project -> [Help 1]

The project org.apache.camel:camel-example-gauth:2.12-SNAPSHOT (C:\Users\avinashms\camel-example-gauth\pom.xml) has 1 error
Non-resolvable parent POM: Could not find artifact org.apache.camel:examples:pom:2.12-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 22, column 13 -> [Help 2]
o see the full stack trace of the errors, re-run Maven with the -e switch.
e-run Maven using the -X switch to enable full debug logging.

or more information about the errors and possible solutions, please read the following articles:
Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
avinashms\camel-example-gauth>


Below is my pom.xml file :


7 years ago