Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JFB-9: Add Hibernate support and perform CRUD operations #11

Closed
wants to merge 30 commits into from

Conversation

rtemirbulat
Copy link
Owner

Add Hibernate dependencies to your project.
Implement the functionality from the Homework from Lesson 8 with a help of Hibernate.
Save Tickets and Users.
Fetch Tickets by ID and user ID and Users by ID.
Update Tickets type.
Delete Users by ID and their tickets (if any).
Add a functionality that allows to update both User and all his tickets in the same transaction using Hibernate.

rtemirbulat and others added 30 commits June 6, 2024 21:13
…ction to the TicketService that returns ticket by stadium sector.
…ction to the TicketService that returns ticket by stadium sector.
Change ticket class, time. Add getters and setters. Develop ticket
generator
TO-DO:
Homework: ticket services hierarchy
You have to extend your Ticket application with a new functionality.
1. Any class in your application should be able to have a numeric “ID"
field and be able to get and set it. Think about a proper solution for
that - abstract class or interface?
2. There should be a possibility to add an ability to .print() class
content for every class. Also, there should be a possibility to override
this function as well as use the default implementation, which is "print
content in console".
3. For your Ticket class from the previous lesson, there should be a
possibility to change only "time" and "stadium sector" fields. Also,
there should be a possibility to get all Ticket values.
4. A Ticket should be able to be .shared() by phone and by phone and
email. Think about the type of polymorphism that you will use here. In
the .main() method show the example of the chosen polymorphism approach.
5. In your application, there should be 2 Users - Client and Admin, both
should be able to .printRole() and also have unique functions -
getTicket() for User and checkTicket() - for Admin. Think about
inheritance and the type of polymorphism that you will use here. In the
.main() method show the example of the chosen polymorphism approach.
6. Override equals(), toString() and hashCode() in your Ticket class, so
they will be able to return meaningful values that follow equals &
hashCode contract.
xxx
create your own custom annotation @NullableWarning that will print in
console: “Variable [{variable_name}] is null in [{class}]!”, when stated
above the field of a class and an instance of this class is created via
new keyword.
Like:
@NullableWarning private int id;
Ticket ticket = new Ticket();
Variable [id] is null in [Ticket]!

<img
src=https://raw.githubusercontent.com/rtemirbulat/trainee-edu-hw2/f015afd0feadabe8de49d03b73033d30bd4abfae/screenshot/Screenshot_4.png/>
Task: 
1. Validate each bus ticket, and show warning in case of malicious input
2. Create function to validate bus ticket, show error in the console if
1+ validation rule is violated
3. Output: total tickets, valid tickets, most popular violation
4. Add ability to read tickets from a file
5. Validator - start date can't be in the future
6. Validator - ticket type only day,week,year,month 
7. Validator - price is always even
Rules:
DAY,WEEK,YEAR type can only have start date. Price can't be zero
Homework: Documentation for tickets system
Create a [Bus TicketService] class with the following list of
capabilities:
1) Create a [Bus Ticket] for a specified date and type.
2) Store a ticket in a in-memory storage.
3) Remove a ticket from the storage by ID.
4) Get ticket by ID
5) Search tickets by type and price (from price A to price B)
Cover the class and its function with Java docs where needed. If you
think that the code is "self-explainable" - don't add docs.

![resultHW6](https://github.com/rtemirbulat/java-trainee-edu/assets/30748630/26b91e83-3f93-4657-b0de-f636e933f38b)
you need to create 2 storage classes. your own versions of arraylist and
hashset

your custom arraylist list should allow a user to put, get by index,
delete by index and automatically resize

your custom hashset list should allow a user to put, perform "contains"
check, iterate, delete, automatically resize and keep objects uniquenes

![result](https://github.com/rtemirbulat/java-trainee-edu/assets/30748630/8660e0a1-68fa-40ab-aa6a-7ad13d6da7af)
@rtemirbulat rtemirbulat closed this Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants