HIPAA only applies to covered entity. The state government is NOT a covered entity. If you've been involuntarily committed, it IS out there. Further, I suspect that one of the poster's issues he's having with his DV issue is firearms ownership. You can be darned sure that we also check for commitments on those.
I think we may be talking about two different issues, and that is my fault. The first issue involves mental health commitments of the involuntary kind absent a conviction, and the second, a plea to "not guilty" by reason of mental illness.
Those involuntary commitment records are held by a medical provider and NOT the court. It takes a court order, generally, to obtain those records. You can get criminal histories from courts and public records requests - this is generally not the case with mental health commitments (at least I am unfamiliar with any public database in any state where these CAN be accessed, but, I don't pretend to know the regulations in all 50 states).
Now, if SENTENCED to a mental health facility after trial (or until they are clear to stand trial) those records will exist as part of the court record.
However, I do not think any state permits a prospective employer to ask about mental health issues prior to employment so I don't know how it might come up unless the employer does a pretty extensive background check where they read the court record. Though, your state may be different than many others.
For government employers and private employers with at least 15 employees the Americans with Disabilities Act (ADA) and the related EEOC regulations prohibit employers from asking about a disability pre-employment, including mental health disabilities. A number of states extend that protection to employees of smaller employers, too.