Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Trevor Bye
Trevor Bye
4,474 Points

Why include javax.Transaction?

What is the purpose of including compile 'javax.transaction:jta:1.1' in the Gradle dependencies? From what I can tell from examining the beginTransaction() method in IntelliJ, it is from the org.Hibernate.Session class. I'm also confused as to why there wouldn't be something like import javax.Transaction; included. Maybe I missed something in the video but it would be great if someone could explain.

1 Answer

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Take a look at the teacher's notes behind the video: https://teamtreehouse.com/library/hibernate-basics/persisting-data-with-hibernate/saving-data-with-hibernate

Chris says that this transaction library will be used in runtime, not during compile. So there is no import statements, but you should get an error I guess when you use transaction in your app without this dependency. I tried without this library and it worked anyway, but I think for that we should ask Chris for more explanation.