Prevent duplicate entries in column using hibernate [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am trying to make a login system for my app using web-service,hibernate and MySql.What I am trying to do is to make separate column for phone number and email id provided by the user.I want my system to work with both the options available,I mean my login system should work for email id and as well as phone no.If my user wants to login with phone number or email id,in both way it should work.But I don't know how to make both of them unique to prevent duplicate entries.If I am using primary key it is working only with one column.I want both of them to be unique for each user registration.

If I understood what you are asking I think you can annotate the both attributes with:
#Column(unique = true)
It will make your attributes unique, so you will ensure that the data won't be duplicated.

Related

How to dynamically add columns in Database? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 months ago.
Improve this question
I have a spring boot project with Mysql & Hibernate, all I need is to provide a privilege to the user to change or alter columns of the database dynamically(runtime), I haven't found any good approach for that XML approach is quite hectic and will require a lot changes to be made.
Example:
A table User with columns
"Username" & "Password"
And from UI client will add another column "email" so it should make changes in Database table.
What you are specifically asking here would need changes to your entities during runtime, and that is not possible. You can achieve a similar solution by adding one additional column customerAttributes to the User table and store that information as map:
#Convert(converter = HashMapConverter.class)
private Map<String, Object> customerAttributes;
There is a good tutorial for that: https://www.baeldung.com/hibernate-persist-json-object

How to implement a checkbox in to a keyboard in Android Studio [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 months ago.
Improve this question
I've built a simple storeHelper app (you can write which products you need to buy, when and in which store) and I want to add a function of adding a checkbox as a user to mark what you've bought from the list, like in a SamsungNotes app, how can I do it + how do I need to change a database to save the status of checkbox?
You can add the checkbox from the Palette in Android Studio, checkbox is available inside the button section in the palette. About the Firebase connection I only know about how to save the user credentials in the database I have no idea about the checkbox status.
#Serg Do provide more details on what database you want to use as the question is very vague. Also, do check the documentation for checkbox and try it out first.
#Manthan For checkbox status it can be stored into Firestore as a field in a document which belongs to the user. Do check out the documentation.

friend request and friendship table, I have an idea is it OK? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have my own server, that get from the client friend requests:
- case 1:
user001 sends friend request to user002
1. I create table called user001 in my server, with two colunms: friendID,status(accepted,blocked ect..)
and insert "user002" as a value of friendId column.
2.and create another table named user002 and insert user001 as a value of friendId column.
so every user has his own table with list of his friends, is this good way, or there is another way...
I choose this way, to make it easy to retrive friend list and another info. about a spicific friend.
You should only create one table, with columns UserId, friendId, Status. That way you can store all data in one table. To get user1's friends, filter on user1's UserId.

Taking a telephone number from the address book [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
If the user taps on a button, the address book should open.
Then the user should choose a contact. The telephone number of the contact should be displayed in the app.
How can I realize this?
I would suggest that instead of opening the contacts application you instead query the ContactsContract.Contacts content provider to get cursor with the list of contacts and display this list in your application. When an item is selected from the resulting view you can easily extract the number and display it.

Generate Textfield as per number given by user in java [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Requirement is like:
I want to take input values from user in frame but no of inputs is also decided by user.
So first,
In frame,I want user to write no of values in one text field
so as soon as user writes that many text fields should be generated in the same frame.
How can this be done?
Is this possible or is there any good way available for this?
I would use a table instead. Either the user can directly edit the table or you provide a "Add New Row" button. In my opinion changing the UI layout (adding text fields) at runtime is bad design.

Categories

Resources