Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring forum!

siddu math

Greenhorn
+ Follow
since Apr 14, 2020
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by siddu math

Thanks Stephan

i tried but gives error because client .upsertQuery has written type Future <JsonObject>.

So the code is some thing like


2 days ago
Thanks Stephan,but i m not able to figure it out.Its giving me error.

   Mockito.when(client.upsertQuery(Mockito.any(),Mockito.any()).onSuccess(Mockito.any())).thenReturn(CompletableFuture.completedFuture(StatusCode.SUCCESS));

StatusCode is an Enum class.

3 days ago
Thanks Ron i have checked this page but i want to mock this Db call, i m not able to get it .
3 days ago
Hi I m new to vertex and below is the code which i have written for an update statement to db, i need to mock this upsertQuery method and write Junit for this, can some body help me on this.

4 days ago
I m new to vertx I mstruggling to build a small POC to just call DB and run a simple query to check connectivity using this vertx , can any one suggest me where can i find any full code base to check on this  or any step by step approach to achieve this.
2 weeks ago
yes i got it. i have added an '_' and then while retreviewing that value in map have removed that '_'
3 months ago
Now what i m trying to do is changed the enum name like EIGHTSS, but need to make it 8SS before sending it to the map, how can do that



Map<String, String> SSS = new HashMap<>();

       SSS = Arrays.stream(MidCheck.values()).collect(Collectors.toMap(Enum::name, MidCheck::getValue));
3 months ago
i have set of contants in Enum class, i got to add a new contants to it but they start with numeric value something like 8SS and this gives me error Please suggest

public enum MidCheck {8SS("SAM") ;


This is giving me error.
Note i cannot change the COnstant name as its refered in mapped.
3 months ago
Thanks . I do agree with your words.I have no idea on ORM hibernate and  due to this COVID  our project has ended and we are assigned this set of courses to complete within a couple of days.

I just posted to get some help to save my job as i m already try to solve other courses.
Which of these are true of state changes of an object?
A. State changes from Persistent to Detached on session.close() during a Read operation
B. State changes from Persistent to Detached on session.delete() during a Delete operation
C. State changes from Transient to Persistent on session.delete() during a Delete operation
D. State changes from Transient to Detached on session.close() during a Read operation
2
Which of these is NOT true of Annotations?
A. Annotations tell Hibernate how to persist a class
B. Entity is an annotation that can be imported from javax.persistence
C. Annotation is prefixed by @ symbol
D. Property is an annotation that can be imported from javax.persistence
3
What are NOT valid annotations for embedded objects?
A. @embeddedObjects
B. @embedded
C. @AttributeOverride
D. @AttributeOverrides
4
session.createCriteria() takes in ________________ as an argument for fetching records
A. Class
B. Query
C. String
D. Integer
5
Which of this is true of keys?
A. Surrogate key can contain duplicates while primary key does not
B. Surrogate Key is not business data, but identifies a record uniquely
C. Primary Key and Surrogate Key can be used interchangably
D. Surrogate key is like a column containing serial number of the records
6
Which of these is true of caching in Hibernate?
A. First Level Cache is a level of cache that is provided by default by Hibernate.
B. First Level Cache can be used only witin the session
C. First Level Cache can be implemented across sessions in a single application, while a Second Level Cache can be implemented across applications
D. Second Level of Cache can be implemented across applications and also clusters
7
In order to apply cache to queries, you must set which of these properties in the Hibernate Configuration file?
A. Set both cache.use_second_level_cache to true and cache.use_query_cache to true. These work together
B. Set only cache.use_second_level_cache to true. This will work for Query as well
C. cache.use_second_level_cache to false and cache.use_query_cache to true. Only one of these can be active at a time
D. cache.use_second_level_cache to true if you use session.get() and cache.use_query_cache to true for any queries
8
With @ManyToMany annotation in User class and @ManyToMany(mappedBy="vehicle") in Vehicle class, Hibernate will create which of these tables?
A. User Details
B. Vehicle
C. Vehicle_UserDetails
D. UserDetails_vehicle
9
Which is the right way to use session.get() method?
A. user = (UserDetails) session.get(Userdetails.UsrId)
B. user = session.get(Userdetails.class, UsrId)
C. user = session.get(Userdetails.UsrId)
D. user = (UserDetails) session.get(Userdetails.class, UsrId)
10
user.setUserName("Test User");
session.save(user);
user.setUserName("Dev User");
will result in
A. Two user records, One with User Name as Test User, and another with UserName as Dev User
B. One user record with UserName as Dev User
C. One user record with UserName as Test User, since no save has been performed on the second user
D. Two user records, One with User Name as Test User, and another as blank record in anticipation of a save
11
Which of these is true of Hibernate Applications?
A. Database needs to be designed
B. JDBC Database needs to be configured
C. DAO Method is required to save object using SQL queries
D. Model Objects should be defined
12
A Value Object
A. Does not have meaning on its own without a parent object
B. Contains values for the attributes of a given object
C. Is used to pass an object as an argument to a function or method
D. None of the above
13
Restrictions are like comparisons in a Where Clause os an SQL Query. Which of these are Restrictions for a Criteria?
A. like
B. eq
C. isNull
D. sizeEq
14
Which of these are mandatorily to be executed for saving an object?
A. Obtain SessionFactory from supplied configuration file
B. Initiate Session from sessionFactory.getCurrentSession() and begin the transaction
C. Commit the transaction
D. Close the session
15
To prevent Hibernate from re-creating the database schema on startup, you need to
A. Set the property hbm2ddl.dbupdate to Create
B. Set the property hbm2ddl.dbupdate to Modify
C. Set the property hbm2ddl.auto to Update
D. Set the property hbm2ddl.auto to Modify
16
Projections are used
A. to forecast information based on a data series
B. for aggregating data
C. with Grouping functions
D. for pulling up a specific property of an object
17
In a SingleTable inheritance strategy, Hibernate will create
A. No table for base class since it is an abstract class and one single table for all the sub-classes put together
B. One table for the Base Class and one single table for all sub-classes put together
C. One single table for the base class and all the sub-classes put together
D. One table for Base Class and one table each for each of the sub-classes
18
CollectionId annotation is a feature of
A. JPA and Hibernate
B. Hibernate only
C. JPA only
D. None of the above
19
minUserId = "5 or 1=1" is a SQL injection on the function session.createQuery(" from Userdetails where UserId > " + minUserId), since
A. It is updating a String input field which is used as a parameter in the query
B. it fetches all records instead of only the intended records with UserId > 5
C. the query is built with a paramter
D. None of the above
20
If a UserDetails object had an embedded collection of addresses, then session.get(UserDetails.class,1) would fetch
A. All addresses associated with UserDetails
B. Only the first address in the list of addresses associated with UserDetails
C. Only the UserDetails data without any of the addresses
D. the nth address as per default specified in Hibernate Configuration File
9 months ago
Thanks i was able to get it proper with below code  but facing new issue.

reader = new BufferedReader(rs.getCharacterStream(1));

resultList.add(reader.readLine());

 out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(absoluteFilePath), "UTF8"));
     
     


for (String line : resultList) {
if (line != null) {
 out.append(line).append("\n");

However  once we deployed on the sever and trying to download the file created its shows gibbresh and however if i download the zip and use winzip to extract the text it show correct value
   
1 year ago
I tried with this

reader = new BufferedReader((rs.getCharacterStream(1)));
System.out.println(reader.readLine());

still no luck and when i try to run the query in DB it gives proper result.
1 year ago
we are getting a large dataset from Stored procedure which we just   write to file.
1 year ago