Mohammed Sardar.

Ranch Hand
+ Follow
since Jun 22, 2014
Mohammed likes ...
jQuery Spring Java
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
16
Received in last 30 days
0
Total given
7
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mohammed Sardar.

Tim Holloway wrote:Your terminology is a little fuzzy there. But in JPA (not just Hibernate), a Generator is a mechanism for automatically assigning a primary key value when persisting a new object. Once persisted, that key's property value is accessible just like any other Entity property. Generators come in several varieties depending on where they look to determine what the next assignable key value is.

Some DBMS's have their own internal sequence generators also. So when defining a JPA Entity key that way, you should use Generator type SEQUENCE.



Thanks Tim but my doubt was at which state JPA/Hibernate assigns the ID to the Entity ? Let me know if my understanding is wrong !!!
I read the below from one of the link "To persist the changes to a transient object, you would have to ask the session to save the transient object to the database, at which point Hibernate assigns the object an identifier and marks the object as being in persistent state." So, I realize an entity get assigned with an identifier during "Transient" state itself and then move to persistent state....
Hi All,

Have a nice day. would like to have a clarification regarding ID generator and states of an entity in hibernate. Request to share your comments on this. We've some states with hibernate entity(Transient, Persistent, Detached), In which state an entity assigned its Pirmary key(Assigned)?. I think,Persistent state if we have specified GeneratorStrategy as either SEQUENCE OR IDENTITY. If not then we've to set this ID manually before calling session.save(). What's your infer on this? Thanks so much.
Thanks Ankit Garg. Your answer above also helps me. But what if we want more objects to be created and given to Spring container ? So that they can Autowired in other related pojos ? Can we specify a package of more java classes to be created as well instead creating each one ?
9 months ago
Hi,

I 'm trying to access the properties file other than a place where all the application's configuration resides, so I'm trying to use @Environment twice in my applicatiobn.  I'm trying to load a properties to implement a email notification functionality to access the properties file using @Environment by Autowiring.  But I'm failing while reading the property file using env.getProperty("email.smtp.host")); Getting null in the place of property value when executing the app.  Actually, I'm trying to use two Configuration file, is this what blocks me to autowire Environment property ? I tried to replace with @Component and adding email package to componentscan list as well.  Can you someone shed some light on this please ?

1. Tried to resolve this by implementing EnvironmentAware  interface as below to get the property value using load() but that still didn't help me.



9 months ago
I was able to reach desired("/registration") page. One of the main reason for the blocker was to trying to create a table with name "User" which is not possible in SQL. User is a reserved table!!
9 months ago
I'm trying to understand connection pooling properties in detail, Before I come I read the descriptive explanation by surfing the net but would like to ensure my understanding is on right track.
Below are some of the configuration properties of DBCP connection pooling referred from dbcp_connection pooling


ParameterDefaultDescription
initialSize0The initial number of connections that are created when the pool is started.
maxTotal8The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit.
maxIdle8The maximum number of connections that can remain idle in the pool, without extra ones being released, or negative for no limit.
minIdle0The minimum number of connections that can remain idle in the pool, without extra ones being created, or zero to create none.
maxWaitMillisindefinitelyThe maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception, or -1 to wait indefinitely.


maxTotal - Does the description mean at the same time multiple connections can be released from the pool for different connection ? If so one connection enough for one all transaction ? Or multiple DB transaction will request for various connections ?

minTotal - Does the property indicates there are some minimum connection always available in the pool ? If the no of connection idle < minIdle then how the numbers will be regulated if all other connections are actively servicing other request ? Is this job of connection pool ? I'm trying to know what will be happen if min idle no of connection goes down ? Please help to understand.

maxWaitMillis - Will the pool wait at this point for the specified amount of time and if it didn't get back to any connection to serve the request, will raise an Exception ?

Thanks,
Mohammed Sardar

9 months ago
Hi All,

I'm trying to create a login page with Registration form using Spring security version. Below is the code to implement the functionality. I've been looking for the solution why I'm unable to reach out the registration page. Trying to access the registration form with URI(http://localhost:8081/registration) When trying to access the registration page, the page by itself redirects to login page. If someone get any idea please share and help me on how to debug this issue and find the solution. How spring boot application can be debugged to figure out this kind of issue. Thanks.







Regards,
Mohammed Sardar
9 months ago

Stephan van Hulst wrote:Yes, although I don't know why you would want to have an age field if you already have a date of birth field.



True, may be Edit button was disabled !!!

Stephan van Hulst wrote:I don't think that Gender would be so complex to warrant an embeddable type. Just use an enum for Gender and you can annotate the gender field with @Enumerated in your Person entity.


Stephan, by your idea what I understand is change to the db design of table structure itself. Instead having two tables (Boy and Girl) have one table with the name PERSON with attributes(NAME, AGE, DOB, GENDER(ENUM)) and represent the above Person table as a single Entity. Am I on track to get the above ?

Thanks & Regards.

Tim Holloway]If you have set up Tomcat in its default configuration and you deploy a WAR to TOMCAT_HOME/webapps, then Tomcat will automatically deploy that WAR, and as part of the default deployment mechanism, if your WAR is in fact a WAR file, it will "explode" (unzip) that WAR file and use the exploded resources to service requests for that webapp.



Thanks Tim for explaining various options and it's really good learning to me. But I still have many doubts to explore these options to know more from technical perspective. I hope you will shed some light to my novice brain.

1. If you have set up Tomcat in its default configuration and you deploy a WAR to TOMCAT_HOME/webapps, then Tomcat will automatically deploy that WAR, and as part of the default deployment mechanism, if your WAR is in fact a WAR file, it will "explode" (unzip) that WAR file and use the exploded resources to service requests for that webapp.

Does all the wep servers explode the war file to know all the configuration stuff to execute the application ?. (IBM, WebSphere)

2. But let's ignore the WAR file right now and look at the exploded WAR. Can you replace application files in-place in Tomcat while a webapp is running? Absolutely! Tomcat periodically (every few seconds) will scan each deployed webapp, and if it detects changes, it will re-reploy that app using the new files.


So, Once the WAR is deployed how can we change the properties file which is with (.properties extension). Correct me if I'm wrong do you mean make correction and then deploy the file or through code can we make changes to the application.properties ? or by running any batches ? I don't get that point actually. What I've learned once we deployed the WAR that'it until and unless till we redeploy the same copy will run in the server. Also I'm thinking how can we make changes to the WAR file without opening the properties in any IDE ?

3. A well-run shop should have some sort of process for managing production app updates. For non-critical updates, that would generally mean scheduling a fixed downtime window. For critical updates, restarting Tomcat doesn't take long if you must, although I'd hope that some senior people would have to approve it.

I agree but this happens with own intention of Business to make this change. Yes, It was a hypothetical to me as well. '

4. And for zero-downtime shops, you're probably best off running Tomcat clusters and cycling the updates into each cluster member one by one.

I'm still a growing developer who starves for knowledge so I'm trying to understand the role of clusters in Webapp world from now on. Thanks for that.

Thanks.
10 months ago
Stephan, I'm thinking after the application starts and being in running state in production environment. How can we bring the changes to the properties into effect ?
10 months ago
Hi All,

Recently, I came across a question can we bring an changes properties to be effect without redeployment of the app ? That's too in Production server ! I tried to answer as restarting server as well but the answer was declined.  Do we've any turn around in like this situation ? Your ideas are welcome.

Thanks.
10 months ago

Stephan van Hulst wrote:Ehh, how about a 'person' entity with a 'gender' field?


Thanks, so "Gender" as @Embedded you mean ? Can you elaborate please ?
Hi All,

I heard a technical scenario where 2 entities having same attributes. A Boy and Girl Entity with Name, Age and DOB. How this can be formed as single entity so that fields are not repetitive ? Please share any idea. I'm also keen to find the right solution through studies. But your ideas may also help. Thanks.

Regards,
Mohammed Sardar